Table of Contents

MovieClip

Inherits: Sprite

Supported platforms:

Available since version: 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:
<ul>
<li>x</li>
<li>y</li>
<li>rotation</li>
<li>scale</li>
<li>scaleX</li>
<li>scaleY</li>
<li>alpha</li>
</ul>
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.
<br />
The following easing functions can be used:
* &quot;inBack&quot;
* &quot;outBack&quot;
* &quot;inOutBack&quot;
* &quot;inBounce&quot;
* &quot;outBounce&quot;
* &quot;inOutBounce&quot;
* &quot;inCircular&quot;
* &quot;outCircular&quot;
* &quot;inOutCircular&quot;
* &quot;inCubic&quot;
* &quot;outCubic&quot;
* &quot;inOutCubic&quot;
* &quot;inElastic&quot;
* &quot;outElastic&quot;
* &quot;inOutElastic&quot;
* &quot;inExponential&quot;
* &quot;outExponential&quot;
* &quot;inOutExponential&quot;
* &quot;linear&quot;
* &quot;inQuadratic&quot;
* &quot;outQuadratic&quot;
* &quot;inOutQuadratic&quot;
* &quot;inQuartic&quot;
* &quot;outQuartic&quot;
* &quot;inOutQuartic&quot;
* &quot;inQuintic&quot;
* &quot;outQuintic&quot;
* &quot;inOutQuintic&quot;
* &quot;inSine&quot;
* &quot;outSine&quot;
* &quot;inOutSine&quot;
Following examples demonstrates the possible uses of MovieClip class.

Common uses and 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

Methods, events and properties: