2007年10月19日金曜日

AfterEffectsエクスプレッション講座 その12(平面のサークル運動)

平面をサークル運動させる。(三角関数を使う)

三角関数を用いた最も代表的な作成事例でネットでも比較的
サンプルが多い事例ですが、ここでは回転の周期をtimeで制御
できるようにしたいと思います。

以下のコードで作成します。

r = 100 ; 
w = this_comp.width/2 ;
h = this_comp.height/2 ;
t = 3 ;
d = 360/t;
ra = degrees_to_radians(time*d-90);
[Math.cos(ra)*r+w,Math.sin(ra)*r+h]

r = 100 ; で回転の半径を指定します。

w = this_comp.width/2 ;
h = this_comp.height/2 ;
で回転の中心を指定します。

t = 3 ;で一周する時間を指定します。

d = 360/t;で一秒間で回転する角度を求めます。

ra = degrees_to_radians(time*d-90);
でラジアンに変換します。

[Math.cos(ra)*r+w,Math.sin(ra)*r+h]
Xにcosineの計算結果、Yにsineの計算結果をいれます。

0 件のコメント: