Activity › Forums › Adobe After Effects Expressions › Offset animation, then loopOut.
-
Offset animation, then loopOut.
Posted by Griffin Englander on November 7, 2024 at 12:32 amHello all,
Is there a way to offset the time of some animation (using valueAtTime & framesToTime currently), and then loopOut from that new time?
I basically want the time of 2 keyframes to be offset (temporally) by a slider, and then loopOut(offset or continue) from there.
Hopefully it’s obvious, and I’m just dumb.
Thanks in advance.
Brie Clayton replied 2 months, 1 week ago 4 Members · 6 Replies -
6 Replies
-
Yoan Boisjoli
November 7, 2024 at 12:45 amHi Griffin! Is the property only one value or an array of 2 or more?
-
Dan Ebberts
November 7, 2024 at 12:47 amI’m not real clear on exactly what you’re asking, but it might end up being something like this:
tOffset = effect("Slider Control")("Slider");
t1 = key(1).time;
t2 = key(2).time;
dur = t2 - t1;
t = (time - (t1 + tOffset))%dur;
valueAtTime(t1+t) -
Griffin Englander
November 7, 2024 at 12:55 amThanks guys.
Hi Yoan! It’s a value of 1 in this case mate.
Dan, I’ll try and explain a little better.
I have a tall strip of numbers pre-comped (think an odometer), and this precomp has 3 keyframes on its Y position. Say two keyframes to go from 0 – 100, then a third keyframe to dictate the pause before loopOut(“offset”) comes in and exponentially cycles the animation.
What I’m hoping for, is to use another slider to offset the point at which that whole animation starts.
Sorry if that’s even less clear, but thank you for helping.
-
Yoan Boisjoli
November 7, 2024 at 1:24 amAlright I got something like that to work. I’m animating the slider with hold keyframes but feel free to try something else. I’m joining a screencast of how it’s behaving and my ae file also.
// Time Offset from Slider
var offset = effect("Slider Control")("Slider")/10; //dividing it by 10 becasue it's sensitive
// Total duration of the loop (from first to last keyframe)
var firstKeyTime = key(1).time;
var lastKeyTime = key(numKeys).time;
var loopDuration = lastKeyTime - firstKeyTime;
// Current Time adjusted by the offset
var adjustedTime = time - offset;
// Calculate the looped time
var loopedTime = (adjustedTime - firstKeyTime) % loopDuration + firstKeyTime;
// Ensure loopedTime doesn't go below the first keyframe time
loopedTime = (loopedTime < firstKeyTime) ? firstKeyTime : loopedTime;
// value at the looped time
valueAtTime(loopedTime);
Reply to this Discussion! Login or Sign Up