Difference between revisions of "MovieClip"
Line 4: | Line 4: | ||
=== Description === | === Description === | ||
<translate><br /> | <translate><br /> | ||
− | The [[MovieClip]] class inherits from the following classes: [[Sprite]] > [[EventDispatcher]].<br /> | + | The [[Special:MyLanguage/MovieClip|MovieClip]] class inherits from the following classes: [[Special:MyLanguage/Sprite|Sprite]] > [[Special:MyLanguage/EventDispatcher|EventDispatcher]].<br /> |
<br /> | <br /> | ||
− | The [[MovieClip]] class is used create static timedlined animations. The timeline parameters are given as an array. <br /> | + | The [[Special:MyLanguage/MovieClip|MovieClip]] class is used create static timedlined animations. The timeline parameters are given as an array. <br /> |
Each array element specifies one timeline element and consists of the starting frame, ending frame, sprite and <br /> | Each array element specifies one timeline element and consists of the starting frame, ending frame, sprite and <br /> | ||
optional tweening parameters. Frame numbers start from 1.<br /> | optional tweening parameters. Frame numbers start from 1.<br /> | ||
<br /> | <br /> | ||
− | When a [[MovieClip]] object finishes it playing (by reaching its final frame or a frame with stop action), <br /> | + | When a [[Special:MyLanguage/MovieClip|MovieClip]] object finishes it playing (by reaching its final frame or a frame with stop action), <br /> |
− | it dispatches an [[Event.COMPLETE]] event.<br /> | + | it dispatches an [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event.<br /> |
<br /> | <br /> | ||
The following properties can be tweened:<br /> | The following properties can be tweened:<br /> | ||
<br /> | <br /> | ||
<ul> | <ul> | ||
− | <li>[[x]]</li> | + | <li>[[Special:MyLanguage/x|x]]</li> |
− | <li>[[y]]</li> | + | <li>[[Special:MyLanguage/y|y]]</li> |
− | <li>[[rotation]]</li> | + | <li>[[Special:MyLanguage/rotation|rotation]]</li> |
− | <li>[[scale]]</li> | + | <li>[[Special:MyLanguage/scale|scale]]</li> |
− | <li>[[scaleX]]</li> | + | <li>[[Special:MyLanguage/scaleX|scaleX]]</li> |
− | <li>[[scaleY]]</li> | + | <li>[[Special:MyLanguage/scaleY|scaleY]]</li> |
− | <li>[[alpha]]</li> | + | <li>[[Special:MyLanguage/alpha|alpha]]</li> |
</ul> | </ul> | ||
<br /> | <br /> | ||
− | Additionally [[MovieClip]] uses set function to tween properties, so if you override provided object's set function by adding new parameters it can accept, then you can tween those new parameters too. | + | Additionally [[Special:MyLanguage/MovieClip|MovieClip]] uses set function to tween properties, so if you override provided object's set function by adding new parameters it can accept, then you can tween those new parameters too. |
Line 32: | Line 32: | ||
The following easing functions can be used:<br /> | The following easing functions can be used:<br /> | ||
<br /> | <br /> | ||
− | * [["inBack"]]<br /> | + | * [[Special:MyLanguage/"inBack"|"inBack"]]<br /> |
− | * [["outBack"]]<br /> | + | * [[Special:MyLanguage/"outBack"|"outBack"]]<br /> |
− | * [["inOutBack"]]<br /> | + | * [[Special:MyLanguage/"inOutBack"|"inOutBack"]]<br /> |
− | * [["inBounce"]]<br /> | + | * [[Special:MyLanguage/"inBounce"|"inBounce"]]<br /> |
− | * [["outBounce"]]<br /> | + | * [[Special:MyLanguage/"outBounce"|"outBounce"]]<br /> |
− | * [["inOutBounce"]]<br /> | + | * [[Special:MyLanguage/"inOutBounce"|"inOutBounce"]]<br /> |
− | * [["inCircular"]]<br /> | + | * [[Special:MyLanguage/"inCircular"|"inCircular"]]<br /> |
− | * [["outCircular"]]<br /> | + | * [[Special:MyLanguage/"outCircular"|"outCircular"]]<br /> |
− | * [["inOutCircular"]]<br /> | + | * [[Special:MyLanguage/"inOutCircular"|"inOutCircular"]]<br /> |
− | * [["inCubic"]]<br /> | + | * [[Special:MyLanguage/"inCubic"|"inCubic"]]<br /> |
− | * [["outCubic"]]<br /> | + | * [[Special:MyLanguage/"outCubic"|"outCubic"]]<br /> |
− | * [["inOutCubic"]]<br /> | + | * [[Special:MyLanguage/"inOutCubic"|"inOutCubic"]]<br /> |
− | * [["inElastic"]]<br /> | + | * [[Special:MyLanguage/"inElastic"|"inElastic"]]<br /> |
− | * [["outElastic"]]<br /> | + | * [[Special:MyLanguage/"outElastic"|"outElastic"]]<br /> |
− | * [["inOutElastic"]]<br /> | + | * [[Special:MyLanguage/"inOutElastic"|"inOutElastic"]]<br /> |
− | * [["inExponential"]]<br /> | + | * [[Special:MyLanguage/"inExponential"|"inExponential"]]<br /> |
− | * [["outExponential"]]<br /> | + | * [[Special:MyLanguage/"outExponential"|"outExponential"]]<br /> |
− | * [["inOutExponential"]]<br /> | + | * [[Special:MyLanguage/"inOutExponential"|"inOutExponential"]]<br /> |
− | * [["linear"]]<br /> | + | * [[Special:MyLanguage/"linear"|"linear"]]<br /> |
− | * [["inQuadratic"]]<br /> | + | * [[Special:MyLanguage/"inQuadratic"|"inQuadratic"]]<br /> |
− | * [["outQuadratic"]]<br /> | + | * [[Special:MyLanguage/"outQuadratic"|"outQuadratic"]]<br /> |
− | * [["inOutQuadratic"]]<br /> | + | * [[Special:MyLanguage/"inOutQuadratic"|"inOutQuadratic"]]<br /> |
− | * [["inQuartic"]]<br /> | + | * [[Special:MyLanguage/"inQuartic"|"inQuartic"]]<br /> |
− | * [["outQuartic"]]<br /> | + | * [[Special:MyLanguage/"outQuartic"|"outQuartic"]]<br /> |
− | * [["inOutQuartic"]]<br /> | + | * [[Special:MyLanguage/"inOutQuartic"|"inOutQuartic"]]<br /> |
− | * [["inQuintic"]]<br /> | + | * [[Special:MyLanguage/"inQuintic"|"inQuintic"]]<br /> |
− | * [["outQuintic"]]<br /> | + | * [[Special:MyLanguage/"outQuintic"|"outQuintic"]]<br /> |
− | * [["inOutQuintic"]]<br /> | + | * [[Special:MyLanguage/"inOutQuintic"|"inOutQuintic"]]<br /> |
− | * [["inSine"]]<br /> | + | * [[Special:MyLanguage/"inSine"|"inSine"]]<br /> |
− | * [["outSine"]]<br /> | + | * [[Special:MyLanguage/"outSine"|"outSine"]]<br /> |
− | * [["inOutSine"]]<br /> | + | * [[Special:MyLanguage/"inOutSine"|"inOutSine"]]<br /> |
<br /> | <br /> | ||
Following examples demonstrates the possible uses of MovieClip class.<br /> | Following examples demonstrates the possible uses of MovieClip class.<br /> | ||
Line 112: | Line 112: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Methods === | === Methods === | ||
− | [[MovieClip.new]] ''<translate>creates a new MovieClip object</translate>''<br/> | + | [[Special:MyLanguage/MovieClip.new|MovieClip.new]] ''<translate>creates a new MovieClip object</translate>''<br/> |
− | [[MovieClip:clearAction]] ''<translate>clears the action at the specified frame</translate>''<br/> | + | [[Special:MyLanguage/MovieClip:clearAction|MovieClip:clearAction]] ''<translate>clears the action at the specified frame</translate>''<br/> |
− | [[MovieClip:getFrame]] <br/> | + | [[Special:MyLanguage/MovieClip:getFrame|MovieClip:getFrame]] <br/> |
− | [[MovieClip:gotoAndPlay]] ''<translate>goes to the specified frame and starts playing</translate>''<br/> | + | [[Special:MyLanguage/MovieClip:gotoAndPlay|MovieClip:gotoAndPlay]] ''<translate>goes to the specified frame and starts playing</translate>''<br/> |
− | [[MovieClip:gotoAndStop]] ''<translate>goes to the specified frame and stops</translate>''<br/> | + | [[Special:MyLanguage/MovieClip:gotoAndStop|MovieClip:gotoAndStop]] ''<translate>goes to the specified frame and stops</translate>''<br/> |
− | [[MovieClip:play]] ''<translate>starts playing the movie clip</translate>''<br/> | + | [[Special:MyLanguage/MovieClip:play|MovieClip:play]] ''<translate>starts playing the movie clip</translate>''<br/> |
− | [[MovieClip:setGotoAction]] ''<translate>sets a "go to" action to the specified frame</translate>''<br/> | + | [[Special:MyLanguage/MovieClip:setGotoAction|MovieClip:setGotoAction]] ''<translate>sets a "go to" action to the specified frame</translate>''<br/> |
− | [[MovieClip:setReverseAction]] ''<translate>sets a "reverse" action to the specified frame</translate>''<br/> | + | [[Special:MyLanguage/MovieClip:setReverseAction|MovieClip:setReverseAction]] ''<translate>sets a "reverse" action to the specified frame</translate>''<br/> |
− | [[MovieClip:setStopAction]] ''<translate>sets a "stop" action to the specified frame</translate>''<br/> | + | [[Special:MyLanguage/MovieClip:setStopAction|MovieClip:setStopAction]] ''<translate>sets a "stop" action to the specified frame</translate>''<br/> |
− | [[MovieClip:stop]] ''<translate>stops playing the movie clip</translate>''<br/> | + | [[Special:MyLanguage/MovieClip:stop|MovieClip:stop]] ''<translate>stops playing the movie clip</translate>''<br/> |
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
=== Events === | === Events === | ||
− | [[Event.COMPLETE]]<br/> | + | [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/> |
=== Constants === | === Constants === | ||
|} | |} |
Revision as of 16:33, 23 August 2018
Supported platforms: android, ios, mac, pc
Available since: Gideros 2011.6
Description
The MovieClip class inherits from the following classes: Sprite > EventDispatcher.
The MovieClip class is used create static timedlined animations. The timeline parameters are given as an array.
Each array element specifies one timeline element and consists of the starting frame, ending frame, sprite and
optional tweening parameters. Frame numbers start from 1.
When a MovieClip object finishes it playing (by reaching its final frame or a frame with stop action),
it dispatches an Event.COMPLETE event.
The following properties can be tweened:
Additionally MovieClip uses set function to tween properties, so if you override provided object's set function by adding new parameters it can accept, then you can tween those new parameters too.
The following easing functions can be used:
* "inBack"
* "outBack"
* "inOutBack"
* "inBounce"
* "outBounce"
* "inOutBounce"
* "inCircular"
* "outCircular"
* "inOutCircular"
* "inCubic"
* "outCubic"
* "inOutCubic"
* "inElastic"
* "outElastic"
* "inOutElastic"
* "inExponential"
* "outExponential"
* "inOutExponential"
* "linear"
* "inQuadratic"
* "outQuadratic"
* "inOutQuadratic"
* "inQuartic"
* "outQuartic"
* "inOutQuartic"
* "inQuintic"
* "outQuintic"
* "inOutQuintic"
* "inSine"
* "outSine"
* "inOutSine"
Following examples demonstrates the possible uses of MovieClip class.
Examples
Example
-- construct a 100 frame animation where x coordinate of sprite tweens from 0 to 200 linearly
local mc = MovieClip.new{
{1, 100, sprite, {x = {0, 200, "linear"}}}
}
-- construct a 100 frame animation where x coordinate of sprite is 50 (constant) and
-- y coordinate of sprite tweens from 50 to 150 by using inBounce function
local mc = MovieClip.new{
{1, 100, sprite, {x = 50, y = {50, 150, "inBounce"}}}
}
-- construct a 200 frame animation where sprite1 and sprite2 tweens differently
-- here sprite1 is visible between frames [1, 150]
-- and sprite2 is visible between frames [100, 200]
local mc = MovieClip.new{
{1, 100, sprite1, {x = {0, 200, "linear"}}},
{50, 150, sprite1, {y = {0, 100, "linear"}, alpha = {0, 1, "easeOut"}}},
{100, 200, sprite2, {x = {0, 200, "linear"}}},
}
-- construct a looping 6 frame animation where each frame is a different sprite
local mc = MovieClip.new{
{1, 1, frame1},
{2, 2, frame2},
{3, 3, frame3},
{4, 4, frame4},
{5, 5, frame5},
{6, 6, frame6},
}
mc:setGotoAction(6, 1) -- if the animation reaches frame 6 then go to frame 1
-- construct a looping 6 frame animation playing 5 times slower than the previous example
local mc = MovieClip.new{
{1, 5, frame1},
{5, 10, frame2},
{11, 15, frame3},
{16, 20, frame4},
{21, 25, frame5},
{26, 30, frame6},
}
mc:setGotoAction(30, 1) -- if the animation reaches frame 30 then go to frame 1
MethodsMovieClip.new creates a new MovieClip object |
EventsConstants |