BetweenAS3 練習2
/**
* Copyright kazuyuki ( http://wonderfl.net/user/kazuyuki )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/zEd7
*/
// forked from kazuyuki's forked from: BetweenAS3 easingいろいろ練習
// forked from kazuyuki's BetweenAS3 easingいろいろ練習
package {
import flash.display.Sprite;
import flash.events.Event;
import org.libspark.betweenas3.BetweenAS3;
import org.libspark.betweenas3.easing.*;
import org.libspark.betweenas3.tweens.ITween;
import flash.utils.Timer;
import flash.display.Shape;
import flash.events.MouseEvent;
public class FlashTest extends Sprite {
public function FlashTest() {
stage.addEventListener(MouseEvent.MOUSE_DOWN,downHandler);
}
public function downHandler(e:MouseEvent):void{
var _mouseX:Number = stage.mouseX;
var _mouseY:Number = stage.mouseY;
for(var i:int = 0; i<360; i += 15){
var box1:Box = addbox(0,0);
var box2:Box = addbox(0,0);
var box3:Box = addbox(0,0);
var t0:ITween = BetweenAS3.parallel (BetweenAS3.tween(box1,{x:465*Math.cos(i*Math.PI/180)+_mouseX, y:465*Math.sin(i*Math.PI/180)+_mouseY, rotationX:1800}, {x:_mouseX, y:_mouseY}, 5,Quart.easeIn),
BetweenAS3.tween(box2,{x:465*Math.cos(i*Math.PI/180)+_mouseX, y:465*Math.sin(i*Math.PI/180)+_mouseY, rotationX:1800}, {x:_mouseX, y:_mouseY}, 4, Quart.easeIn),
BetweenAS3.tween(box3,{x:465*Math.cos(i*Math.PI/180)+_mouseX, y:465*Math.sin(i*Math.PI/180)+_mouseY, rotationX:1800}, {x:_mouseX, y:_mouseY}, 3, Quart.easeIn)
)
t0.stopOnComplete = true;
t0.play();
}
}
private function addbox(x:Number, y:Number):Box{
var box:Box = new Box();
box.x = x;
box.y = y;
addChild(box);
return box;
}
}
}
import flash.display.Sprite;
internal class Box extends Sprite{
public function Box(){
graphics.beginFill(Math.random()*0xffffff);
graphics.drawRect(0,0,10,10);
graphics.endFill();
}
}