Tweenerでタイムリマップ(速度変更)

Tweenerで再生時間を変更してスローや瞬間的に高速に再生したりできます。
それをタイムリマップと言うらしい。

This movie requires Flash Player 9

先回知ったTweenerの関数、setTimeScaleを使って簡単に出来そうです!

マウスの設定とアニメーションの開始

private function start(e:MouseEvent):void {
	stage.addEventListener(MouseEvent.MOUSE_DOWN, down );
	stage.addEventListener(MouseEvent.MOUSE_UP, up );
	story1();
}

アニメーションのループ

private function story1():void{
	Tweener.addTween( ball , { x:400 , rotation:180 , time:1 , transition:"easeOutBack" , onComplete:story2} );
}
 
private function story2():void{
	Tweener.addTween( ball , { x:100 , rotation:360 , time:1 , transition:"easeOutBack" , onComplete:story1} );
}

タイムスケールの変更

private function down(e:MouseEvent):void {
	Tweener.setTimeScale(0.1);
}
 
private function up(e:MouseEvent):void {
	Tweener.setTimeScale(1);
}

マウスダウンしている間だけ通常の1/10のスピードになります。
どこかで演出として使えたら面白いな。

Filed under AS3, Tweener · Tagged with ,

Comments

2 Responses to “Tweenerでタイムリマップ(速度変更)”

Trackbacks

Check out what others are saying about this post...
  1. [...] This post was mentioned on Twitter by himoton. himoton said: tweenerサンプル マトリックス気分 http://blog.wszz.org/archives/298 [...]

  2. [...] 『Tweenerでタイムリマップ(速度変更)』 http://blog.wszz.org/archives/298 [...]



Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!

You must be logged in to post a comment.