Difference between revisions of "MovieClip"
(added 2 missing properties) |
m (mostly formatting :-)) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | |||
<!-- GIDEROSOBJ:MovieClip --> | <!-- GIDEROSOBJ:MovieClip --> | ||
− | ''' | + | '''Supported platforms:''' [[File:Platform android.png]][[File:Platform ios.png]][[File:Platform mac.png]][[File:Platform pc.png]][[File:Platform html5.png]][[File:Platform winrt.png]][[File:Platform win32.png]]<br/> |
− | ''' | + | '''Available since:''' Gideros 2011.6<br/> |
− | ''' | + | '''Inherits from:''' [[Special:MyLanguage/Sprite|Sprite]]<br/> |
− | === | + | === Description === |
− | The | + | The MovieClip class inherits from the following classes: [[Special:MyLanguage/Sprite|Sprite]] > [[Special:MyLanguage/EventDispatcher|EventDispatcher]]. |
− | The | + | The MovieClip class is used to 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 | + | Each array element specifies one timeline element and consists of: |
+ | |||
+ | '''the starting frame, the ending frame, a sprite and an optional tweening parameters''' | ||
+ | |||
+ | '''PS:''' frame numbers start from 1 | ||
+ | |||
+ | |||
+ | When a MovieClip object finishes playing (by reaching its final frame or a frame with stop action), it dispatches an [[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]] event. | ||
− | |||
The following properties can be tweened: | The following properties can be tweened: | ||
Line 26: | Line 31: | ||
*''anchorY'' | *''anchorY'' | ||
− | |||
− | The following easing functions can be used: | + | Additionally MovieClip uses a function to tween properties. If you override the default tween function then you can tween this parameter too. The following easing functions can be used: |
* ''"inBack"'' | * ''"inBack"'' | ||
* ''"outBack"'' | * ''"outBack"'' | ||
Line 61: | Line 65: | ||
* ''"inOutSine"'' | * ''"inOutSine"'' | ||
− | + | === Examples === | |
− | |||
− | === | ||
<source lang="lua"> | <source lang="lua"> | ||
-- construct a 100 frame animation where x coordinate of sprite tweens from 0 to 200 linearly | -- construct a 100 frame animation where x coordinate of sprite tweens from 0 to 200 linearly | ||
Line 110: | Line 112: | ||
{|- | {|- | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | === Methods === |
[[Special:MyLanguage/MovieClip.new|MovieClip.new]] ''<translate>creates a new MovieClip object</translate>''<br/><!-- GIDEROSMTD:MovieClip.new(timeline) creates a new MovieClip object --> | [[Special:MyLanguage/MovieClip.new|MovieClip.new]] ''<translate>creates a new MovieClip object</translate>''<br/><!-- GIDEROSMTD:MovieClip.new(timeline) creates a new MovieClip object --> | ||
[[Special:MyLanguage/MovieClip:clearAction|MovieClip:clearAction]] ''<translate>clears the action at the specified frame</translate>''<br/><!-- GIDEROSMTD:MovieClip:clearAction(frame) clears the action at the specified frame --> | [[Special:MyLanguage/MovieClip:clearAction|MovieClip:clearAction]] ''<translate>clears the action at the specified frame</translate>''<br/><!-- GIDEROSMTD:MovieClip:clearAction(frame) clears the action at the specified frame --> | ||
Line 123: | Line 125: | ||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
− | === | + | === Events === |
<!--[[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/>--> | <!--[[Special:MyLanguage/Event.COMPLETE|Event.COMPLETE]]<br/>--> | ||
[[Special:MyLanguage/MovieClip_Event.COMPLETE|MovieClip_Event.COMPLETE]]<br/> | [[Special:MyLanguage/MovieClip_Event.COMPLETE|MovieClip_Event.COMPLETE]]<br/> | ||
<!-- GIDEROSEVT:Event.COMPLETE complete--> | <!-- GIDEROSEVT:Event.COMPLETE complete--> | ||
− | === | + | === Constants === |
|} | |} | ||
{{GIDEROS IMPORTANT LINKS}} | {{GIDEROS IMPORTANT LINKS}} |
Revision as of 05:16, 24 September 2020
Supported platforms:
Available since: Gideros 2011.6
Inherits from: Sprite
Description
The MovieClip class inherits from the following classes: Sprite > EventDispatcher.
The MovieClip class is used to 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, the ending frame, a sprite and an optional tweening parameters
PS: frame numbers start from 1
When a MovieClip object finishes playing (by reaching its final frame or a frame with stop action), it dispatches an Event.COMPLETE event.
The following properties can be tweened:
- x
- y
- rotation
- scale
- scaleX
- scaleY
- alpha
- anchorX
- anchorY
Additionally MovieClip uses a function to tween properties. If you override the default tween function then you can tween this parameter 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"
Examples
-- 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 |