ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Controlling Speed With a Slider Causes Layer to Return to Initial Position at 0

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dean Dixon
Controlling Speed With a Slider Causes Layer to Return to Initial Position at 0
on Jun 27, 2018 at 7:34:51 am

Hi everyone!

I am trying to loop a background animation with ExtendScript and expressions. I want to control the speed with a slider, as well as a global speed slider. I've applied the below expression to each layer.

The problem is, when we put keyframes into any speed slider, the images return toward their start position when the slider is decreasing in value. I suspect this has something to do with the last line of the expression, and that the value is calculated based on starting position, rather than its position at any given frame.

Does anyone have an idea for how to fix this?

add = thisComp.layer("Global").effect("Slider Control")("Slider");
addP = add * 144 / 25.4;
addP *= 1/thisComp.frameDuration;
addP *= effect("Slider Control")("Slider")/100;
x = (addP*time) %15640; //15640 is the total width
value += [x,0];


Return to posts index

Dan Ebberts
Re: Controlling Speed With a Slider Causes Layer to Return to Initial Position at 0
on Jun 27, 2018 at 1:15:54 pm

If I understand what you're trying to do, it's not simple. I think you need the keyframe integrator described here:

http://www.motionscript.com/articles/speed-control.html#linear

You'll have to use it twice, once for the global speed control and again for the local control, and add the results together, and then do the rest of your processing.

Dan



Return to posts index

Dean Dixon
Re: Controlling Speed With a Slider Causes Layer to Return to Initial Position at 0
on Jun 27, 2018 at 3:14:31 pm

Thanks a lot for your quick reply! I'll give this a try when I get back to the office tomorrow. Is this a quirk with the way expressions evaluate against keyframes?


Return to posts index


Dan Ebberts
Re: Controlling Speed With a Slider Causes Layer to Return to Initial Position at 0
on Jun 27, 2018 at 5:00:14 pm

No, it's basically a side effect of the fact that expressions have no memory, so information can't be passed from one frame to the next.

Dan



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]