ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Using Slider Control to change keyframes, and then looping those keyframes

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
David Richards
Using Slider Control to change keyframes, and then looping those keyframes
on Jul 16, 2019 at 10:30:36 am

Hello,

I'm relatively new to AE and have hit a stumbling block.

I am trying to set up a template - the purpose is to be able to drop in images and text in a kind of carousel that could be repurposed and changed depending on circumstances. The various images and text scale up or down over time, all at the same rate, and I want to be able to control the degree of this scaling using sliders.

In order to do this with the text, for example, I have set up a null linked to the scale parameter of all text layers. I want to ensure that each of these text layers grows or shrinks at the same rate. I have used the expression below to allow slider control of the first two keyframes.

My problem is that I don't know how to then loop these keyframes. If I add loopOut() to the end of this expression, the slider values are ignored, and the keyframes loop as if this code didn't exist.

Is there a way to alter the value of keyframes using sliders, and then loop these keyframes?

Thanks for your help in advance,

David

if (numKeys &gt; 1){
t1 = key(1).time;
t2 = key(2).time;
sliderStart = effect("Scale Control Start")("Slider");
v1 = [sliderStart, sliderStart];
sliderEnd = effect("Scale Control End")("Slider")
v2 = [sliderEnd, sliderEnd];
linear(time, t1, t2, v1, v2);
} else {
value
}


Return to posts index

Andrei Popa
Re: Using Slider Control to change keyframes, and then looping those keyframes
on Jul 20, 2019 at 9:50:57 am

Try this:

if (numKeys > 1){
t1 = key(1).time;
t2 = key(2).time;
dur = t2-t1;
sTime = (time-t1)-(time-t1)%dur;
sliderStart = effect("Scale Control Start")("Slider");
v1 = [sliderStart, sliderStart];
sliderEnd = effect("Scale Control End")("Slider")
v2 = [sliderEnd, sliderEnd];
linear(time-t1, sTime, sTime+dur, v1, v2);
} else {
value
}


Andrei
My Envato portfolio.


Return to posts index

David Richards
Re: Using Slider Control to change keyframes, and then looping those keyframes
on Jul 23, 2019 at 10:46:43 am

Thank you, Andrei.

That works exactly as I wished, so I really appreciate you taking the time to reply.

All the best!

David


Return to posts index

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