Activity › Forums › Adobe After Effects Expressions › loopOut on keyframes AND modifying them with the linear() expression
-
loopOut on keyframes AND modifying them with the linear() expression
Patrick Grossien replied 1 year, 10 months ago 4 Members · 16 Replies
-
Dan Ebberts
June 18, 2024 at 3:04 pmI think that would be like this:
first = key(2).value;
second = key(3).value;
newValue = effect("Length 25-80")("Slider");
d = key(numKeys).time - key(1).time;
if (time < key(1).time){
t = key(numKeys).time - (key(1).time - time)%d;
}else if (time > key(numKeys).time){
t = key(1).time + (time - key(numKeys).time)%d;
}else{
t = time;
}
linear(valueAtTime(t), first, second, first, newValue); -
Patrick Grossien
June 27, 2024 at 8:36 amIf I may follow up on this, could you – or someone else who can – explain to me the modulo operation? I still am not sure if I can wrap my head around it.
t = time%key(numKeys).time;
Let me try though:
– take the duration spanning all keyframes of the current property:
key(numKeys).time
– let “t” loop from 0 to x in time increments every time the above keyframe duration fitted into “time”.
So if I have keyframes ranging over 2 seconds, at 2:01 “t” will start to count from 0 to 2 in the same way as “time” would and do that over and over again.
Is this correct? At least that would make sense to me, I guess 😂
-
Dan Ebberts
June 27, 2024 at 12:29 pmThat’s pretty much it. I used that simple form in the first expression because I was assuming that the first keyframe was at time = zero. If that isn’t the case, you have to use the more complex form that involves the times of both the first and last keyframes.
-
Patrick Grossien
June 28, 2024 at 8:00 amThat was perfect and totally what I intended in the beginning. The extending both ways part came later when I realized it could be extremely practical.
Thank you so so much for all your help – past, present and future 🙂
Reply to this Discussion! Login or Sign Up