Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US :: FAQ
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE AFTER EFFECTS:HomeForumBasicsExpressionsTutorialsPodcastsAE TechniquesCreative Cloud DebateFAQ

Am I doing this right?

COW Forums : Adobe After Effects Expressions

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Share on Facebook
Respond to this post   •   Return to posts index   •   Read entire thread


Conrad OlsonAm I doing this right?
by on Nov 30, 2006 at 12:52:40 pm

I am trying to teach myself how to use expressions (with a lot of help from this forum I should add).

One thing I've needed to do several times in my projects is to work out the direction that something is traveling at any point in time so I can adjust and other property or object accordingly. In the case bellow I have set up a particle emitter to move around the screen and I wanted the angle of the emitter to change so that it looks like the tail of a firework or something. I haven't come across a straight forward way of doing this so I've done the following:

old_pos=effect("Particle Playground")("Position").valueAtTime(time-0.2);
new_pos=effect("Particle Playground")("Position");
y_was=old_pos[1];
x_was=old_pos[0];
y_is=new_pos[1];
x_is=new_pos[0];
y_dif=(y_was-y_is);
x_dif=(x_was-x_is);
angle=Math.atan2(y_dif, x_dif);
deg_angle=radiansToDegrees(angle);
[deg_angle+90];

This works well but is it the simplest way of doing this or is there an easier way?

Thanks

Conrad


Posts IndexRead Thread
Reply   Like  
Share on Facebook


Current Message Thread:




LOGIN TO REPLY



FORUMSTUTORIALSFEATURESVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2014 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]