Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Manipulating an expression’s timing

  • Manipulating an expression’s timing

    Posted by Richard Noble on December 16, 2011 at 3:01 pm

    Hello,

    I’m fairly new to expressions and have a problem I’m pretty certain there is a simple solution for.

    I’m using Dan Edbert’s pendulum expression which works amazingly –

    https://www.motionscript.com/expressions-lab-ae65/pendulum.html

    I am applying the expression to the z axis of a piece of footage to simulate a swinging from a wire effect.

    The expression starts at frame 0 by default, but I would like to be able to dictate when the expression starts and stops. For example if I want to start the expression at frame 300 and again at 350 in the same piece of footage, what control setup do I need?

    I’m pretty sure I can use a slider control, but I’m stuck at how to construct the correct controls.

    If someone has a simple solution I would be very grateful

    Thanks
    Richie

    veloc = 7;
    amplitude = 80;
    decay = .7;

    amplitude*Math.sin(veloc*time)/Math.exp(decay*time)

    Kevin Camp replied 14 years, 5 months ago 3 Members · 3 Replies
  • 3 Replies
  • Kevin Camp

    December 16, 2011 at 4:37 pm

    something like this would allow you to use layer markers to control the timing for the start of the ‘wobble’.
    veloc = 7;
    amplitude = 80;
    decay = .7;

    n = 0;
    if (marker.numKeys > 0)
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time) n--;

    if (n > 0)
    t = time - marker.key(n).time;
    else
    t = 0;

    amplitude*Math.sin(veloc*t)/Math.exp(decay*t)
    to control how long it wobbles, you’d need to adjust the veloc, amplitude and/or decay variables.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

  • Dan Ebberts

    December 16, 2011 at 4:49 pm

    Here’s the same thing with a couple of syntax issues resolved:


    veloc = 7;
    amplitude = 80;
    decay = .7;
    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time) n--;
    }

    if (n > 0)
    t = time - marker.key(n).time
    else t = 0;

    amplitude*Math.sin(veloc*t)/Math.exp(decay*t)

    Dan

  • Kevin Camp

    December 16, 2011 at 6:03 pm

    thanks dan…. sorry richard if there was any confusion.

    Kevin Camp
    Senior Designer
    KCPQ, KMYQ & KRCW

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