forked from: forked from: flash on 2009-6-11
Simple tweener example for a friend
/**
* Copyright onedayitwillmake ( http://wonderfl.net/user/onedayitwillmake )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/mjr9
*/
// forked from uwi's forked from: flash on 2009-6-11
// forked from onedayitwillmake's flash on 2009-6-11
// Simple tweener example for a friend
package
{
import flash.display.Sprite;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.easing.*;
[SWF(backgroundColor="#ffffff")]
public class Example extends Sprite
{
private var _circle :Sprite;
public function Example()
{
stage.frameRate = 60;
stage.quality = 'medium';
var i :Number = 0;
while(i < 300)
{
var circleInstance :MyCircle = new MyCircle();
if(Math.random() * 10 < 5)
{
circleInstance.x = -100;
}
else
{
circleInstance.x = 500;
}
/// do the y
if(Math.random() * 10 < 5)
{
circleInstance.y = -100;
}
else
{
circleInstance.y = 600;
}
circleInstance.spin();
addChild(circleInstance);
var finalX :Number = 220;
var finalY :Number = Math.random() * 400;
var t:* = BetweenAS3.tween(circleInstance,
{x: finalX, y: finalY}, null,
Math.random() * 10, Back.easeInOut
)
t = BetweenAS3.delay(t, Math.random() * 2);
t.stopOnComplete = false;
t.play();
i++;
}
// Wonderfl.delay(20)
}
}
}
import flash.display.Sprite;
import flash.events.Event;
internal class MyCircle extends Sprite
{
private var spinSpeed :Number = 3.5;
;
public function MyCircle()
{
// RR GG BB
this.graphics.beginFill(Math.random() * 255 * 255 * 255);
this.graphics.drawRect(0, 0, Math.random() * 200, Math.random() * 10);
this.graphics.endFill();
rotationY = 180
addEventListener(Event.ENTER_FRAME, spinMe);
}
public function spin():void
{
this.rotationY = Math.random() * 360;
}
public function spinMe(e:Event):void
{
rotationY = rotationY + spinSpeed;
}
}