ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

after effects slider controlled keyframes

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Dave Stran
after effects slider controlled keyframes
on Feb 8, 2018 at 5:26:02 pm

-holdTime at keyframes for slideshow variability.-

Hello
I am trying to build a slideshow of sorts for a graphic package.
I want to use a Slider to control how long each photo comp holds at center frame.
An editor will be using this and he may or may not know how to move keyframes.

I have a Null starting Y pos out of frame. a 10 frame transition then hold for (val = slider) then
10 frame transition to the next photo….etc.

So I would like to hold between Keyframe 2 to 3. 4 to 5. 6 to 7 and 8 to 9.
but I don’t want the transitions to change in length (otherwise a time remap would do the job.)
However, if I could also control the transition duration too with a second slider too the editor
could easily adjust the comp to any V.O. he gets.

I tried modifying a variation on aDan Ebberts post, but I couldn’t reverse engineer some items because I didn’t understand what was happening.

< ——— I’ve changing data in this code attached, this was close, but it breaks eventually
entered into expression code box. but the "<" symbol keeps getting replaced by "<" html junk.

holdTime = thisComp.layer("control").effect("Hold")("Slider"); // slider control
k1 = 1;
k2 = 2; // 1st hold
k3 = 3; //
k4 = 4; // 2nd hold
k5 = 5; //
k6 = 6; // 3rd hold
k7 = 7;
k8 = 8; //4th hold

p = transform.position;

t1 = p.key(k1).time;
t2 = p.key(k2).time + holdTime;
t3 = p.key(k3).time;
t4 = p.key(k4).time + holdTime;
t5 = p.key(k5).time;
t6 = p.key(k6).time + holdTime;
t7 = p.key(k7).time;


if (time < t1)
t = time

else if (time < t2)
t = linear(time,t1,t2, t1,p.key(k3).time)
else if (time < t3)
t = time
else if (time < t4)
t = linear(time,t3,t4, t3,p.key(k5).time)
else if (time < t5)
t = time
//else if (time < t6)
// t = linear(time,t5,t6, t5,p.key(k7).time)
//else if (time < t7)
// t = time
else
t = time


valueAtTime(t)

———>
like this example , but better.
video link:
https://imgur.com/a/ZFUeX


any insight or links to insight would be enormously helpful
thank you for your time
Dave

holdTime = thisComp.layer("control").effect("Hold")("Slider"); // slider control
k1 = 1;
k2 = 2; // 1st hold
k3 = 3; //
k4 = 4; // 2nd hold
k5 = 5; //
k6 = 6; // 3rd hold
k7 = 7;
k8 = 8; //4th hold

p = transform.position;

t1 = p.key(k1).time;
t2 = p.key(k2).time + holdTime;
t3 = p.key(k3).time;
t4 = p.key(k4).time + holdTime;
t5 = p.key(k5).time;
t6 = p.key(k6).time + holdTime;
t7 = p.key(k7).time;


if (time &lt; t1)
t = time

else if (time &lt; t2)
t = linear(time,t1,t2, t1,p.key(k3).time)
else if (time &lt; t3)
t = time
else if (time &lt; t4)
t = linear(time,t3,t4, t3,p.key(k5).time)
else if (time &lt; t5)
t = time
//else if (time &lt; t6)
// t = linear(time,t5,t6, t5,p.key(k7).time)
//else if (time &lt; t7)
// t = time
else
t = time


valueAtTime(t)


Return to posts index

Dan Ebberts
Re: after effects slider controlled keyframes
on Feb 8, 2018 at 7:47:08 pm

Something like this maybe:


holdTime = thisComp.layer("control").effect("Hold")("Slider");
transitionTime = thisComp.layer("control").effect("Transition")("Slider");
if (numKeys > 1){
tStart = key(1).time;
if (time < tStart){
key(1).value;
}else{
period = Math.floor((time-tStart)/(holdTime+transitionTime));
if ((period*2+2) > numKeys){
key(numKeys).value;
}else{
t = (time-tStart)%(holdTime+transitionTime);
if (t < transitionTime){
tt = linear(t,0,transitionTime,key(period*2+1).time,key(period*2+2).time);
valueAtTime(tt);
}else{
key(period*2+2).value;
}
}
}
}else{
value;
}



Dan



Return to posts index

Dave Stran
Re: after effects slider controlled keyframes
on Feb 8, 2018 at 9:36:02 pm

This, this is elegant.
thank you, Dan
The editors are going to be so pleased.

best
Dave


Return to posts index

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