Forums › Adobe After Effects Expressions › How To Offset Start Frame of a Loop
-
How To Offset Start Frame of a Loop
-
Mark Walczak
November 12, 2015 at 11:54 pmHi Everyone,
This seems like a very simple task, but I could use some help thinking through it.
Basically, I have a clip of a 10 second loop that is being used three times in my comp. I would like to add some variety, and have each instance of the loop start at a different frame and loop seamlessly.
When dealing with pre-rendered clips, I simply loop the clip in the interpolation settings and slide it in my timeline. When dealing with comps, however, things get a bit more complicated.
My question is whether or not it’s possible to insert an expression into a layer’s time remapping attribute that allows you to simply slide the start frame of a loop and have it play out.
Let me know if this isn’t making sense, and I’ll be happy to clarify.
Thank you!
https://vimeo.com/explosivegraffix
-
Dan Ebberts
November 13, 2015 at 12:05 amSomething like this maybe:
s = Math.round(effect(“Slider Control”)(“Slider”)); // start frame
f = timeToFrames(time);
d = timeToFrames(source.duration);
framesToTime((s+f)%d)Dan
-
Mark Walczak
November 13, 2015 at 4:28 pmDan,
This is EXACTLY what I needed. Thank you so much!
I follow your logic through the expression, but could you tell me what “%” does in the last line?
Thank you!
https://vimeo.com/explosivegraffix
-
Dan Ebberts
November 13, 2015 at 5:33 pm% is the JavaScript modulus operator. It gives you the remainder of a division operation, so it’s what generates the looping value.
Dan
-
Mark Walczak
November 13, 2015 at 5:50 pm
Log in to reply.