Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Dan Ebberts—questions regarding expressions from motionscript.com

  • Dan Ebberts—questions regarding expressions from motionscript.com

    Posted by John Cuevas on March 30, 2006 at 6:25 pm

    First off I want to take the time to thank you for spending your time creating such a valuable learning tool & all of the help you give us javaphobes.

    Finally decided to start exploring the power of java, but I’m a little confused by the mathematical order in this expression. Also have a quick secondary question

    veloc = 40; //horizontal velocity (pixels per second)
    amp =12; //sine wave amplitude (pixels)
    freq = 2.4; //oscillations per second

    x = time*veloc;
    y = amp*time*(Math.sin(freq*time*2*Math.PI) – 1)/2 + thisComp.height/2;
    [x,y]

    In the array here, “veloc = 40; //horizontal velocity (pixels per second)” Everything after the “;” are just notes correct?

    y = amp*time*(Math.sin(freq*time*2*Math.PI) – 1)/2 + thisComp.height/2;
    [x,y]

    (freq*time*2*math.pi) is calculated first, then multiplied by Sin, then -1, /2

    Thank you
    Johnny Cuevas
    Editor
    Ck&Co

    John Cuevas replied 20 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    March 30, 2006 at 6:35 pm

    >Finally decided to start exploring the power of java,

    Actually, AE’s expression and scripting languages are based on JavaScript.

    >Everything after the “;” are just notes correct?

    Yes. Javascript considers everything on a line after “//” to be a comment.

    >(freq*time*2*math.pi) is calculated first, then multiplied by Sin, then -1, /2

    Actually, freq*time*2*math.pi becomes the argument to the Math.sin trig function. The range of that function is +1 to -1. So subtracting one makes the range 0 to -2. Then, dividing by two makes the range 0 to -1 (which is what the expression needs).

    Dan

  • John Cuevas

    March 30, 2006 at 7:03 pm

    Thank you Dan

    I’m only about 16 years removed from the last time I used trig fuctions and basic alegebra. Took me a bit to wrap my head around exactly how it worked out.

    I feel for you having to deal with students like me. Again, I really appreciate you taking the time to put up motionscripts.com. Been using AE since Cosa 3.0, it’s about time I start fully taking advatage of the program.

    Johnny

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy