FORUMS: list search recent posts

# Manipulating an expression's timing

FAQ   •   VIEW ALL
 Manipulating an expression's timing on Dec 16, 2011 at 3:01:12 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 -

http://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) ```

 Re: Manipulating an expression's timingon Dec 16, 2011 at 4:37:41 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

 Re: Manipulating an expression's timingon Dec 16, 2011 at 4:49:41 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

 Re: Manipulating an expression's timingon Dec 16, 2011 at 6:03:11 pm

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

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW