FORUMS: list search recent posts

How to stop expression with Slider?

FAQ   •   VIEW ALL
 How to stop expression with Slider? on Jan 24, 2014 at 9:30:50 pmLast Edited By Michael Garske on Jan 24, 2014 at 9:37:39 pm

I'm very new to expressions and am wondering how I might go about integrating a slider to control when an expression stops using the slider's keyframes.

I'm using this basic expression for the classic clock hand animation :

time*360

Thanks so much for your help!

 Re: How to stop expression with Slider?on Jan 24, 2014 at 9:53:30 pm

So if you have your "time*360" expression driving a slider control, you want that slider to stop counting up when it reaches a certain frame? And I'm assuming maintaining whatever value it stopped at?

Or you want it to count up until it reaches a specific value?

Philip. Bowser

 Re: How to stop expression with Slider?on Jan 24, 2014 at 9:57:23 pm

i'd try stoping it with a layer marker:

```if (marker.numKeys > 0)
if (time > marker.key(1).time)
n = marker.key(1).time
else
n = time
else
n = time

d = 100
Math.round (n*d)/d```

the expression will use the time at the point of the layer marker as the final/stop position of the hand.

if you needed to stop and start the hand, to get the most control, instead of linking the expression to time, you could link it to a slider on the same layer...

```n = effect("Slider Control")("Slider")
d = 100
Math.round (n*d)/d```

if you add a keyframe to the slider at :00.0 with a value of 0, and then another keyframe at say :10.0 with a value of 10, you'd get the same animation as n = time, but the animation would stop at :10.

then if you wanted it to start again at :15.0, you'd just add a keyframe at that point (value 10) and then another keyframe later with a value relative to the between the stop and re-start keyframes (in this example 5).

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW