PDA

View Full Version : idiot movement question

Clinical
9th December 2002, 20:17
Just a quickie for anybody that likes answering stupid questions... how do I make something rotate in 2-D? I have a nifty effect that I'm using, and I want it to rotate clockwise, but for some reason (most likely my mathematical ineptitude) I can't figure out how to do it. :igor: Could somebody point me in the right direction...? Thanks.

uNDefineD
9th December 2002, 21:06
In a movement, type:

r=r+0.1;

Increase the 0.1 for a faster rotation. Or for more responsiveness, type this in a DM:

init: a=1;
frame: fr=fr+bfr*a;
beat: bfr=rand(10)/100; a=-a;
pixel: r=r+fr;

In pixel, add d=d/1.05 for a bit of zoom.

nixa
9th December 2002, 21:09
If you need a list of effects rotating use a dynamic movement:
frame: t=t+0.05;
pixel: r=r+t;
if you need a super scope rotating add t=t+0.05 to frame and this to end of poind section:
svx=x;x=sin(t)*x+cos(t)*y;y=cos(t)*svx-sin(t)*y;

Jaheckelsafar
10th December 2002, 05:48
You can also rotate in the cartesian system.

x1=cos(r)*x+sin(r)*y;
y1=-sin(r)*x+cos(r)*y;
x=x1;
y=y1;

It's faster that converting to polar then back (I think).

dirkdeftly
10th December 2002, 05:58
Quicker, but less acurate. The rectangular rotation is ellipsoidal, instead of circular.

Jaheckelsafar
10th December 2002, 06:33
You can scale the rotation the normal way.

x1=(cos(r)*y+cos(r)*y)*h/w;

Clinical
10th December 2002, 18:33
Argh... this is not working out the way I wanted it to... this thing does not rotate well, apparently. Thanks for the help though, I'll keep it in mind next time I want to rotate something. :)

Jaheckelsafar
11th December 2002, 06:28
Post the preset. Let us see the code, maybe we can spot errors.