ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Time Remapping 4 Markers control expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nicola Poz Possi
Time Remapping 4 Markers control expression
on Mar 27, 2018 at 4:43:44 pm

Hi everyone!

I need help to build a time remapping expression to control an animation intro, middle section and outro duration by moving 3 markers.
I'd like to have 4 markers:

"Start" when the intro starts
"In" when the intro finishes
"Out" when the outro starts
"End" when the outro ends

What I'd like to have is an expression that "links" this 4 markers to my classic 4 time remapping keyframes so that moving the markers changes start points of the 2 animation and their durations. I hope I described the situation in a comprehensible way.

I am sure it's not the first time this question is asked but I searched and searched but I found just an expression to move "In" and "Out" markers keeping intro and outro to their original duration, but it's not what I need.

Thank you so much for your help

Greetings from an Italian noob motion graphic designer


Return to posts index

Dan Ebberts
Re: Time Remapping 4 Markers control expression
on Mar 28, 2018 at 12:17:04 am

Something close to this probably:


m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
if (n ==0)
t = 0
else if (n < 4)
t = linear(time,m.key(n).time,m.key(n+1).time,key(n).time,key(n+1).time)
else
t = key(4).time;
valueAtTime(t);



Dan



Return to posts index

Nicola Poz Possi
Re: Time Remapping 4 Markers control expression
on Apr 5, 2018 at 5:05:27 pm

Dear Dan,

thank you so much for your answer, I finally have found the time to check your code and it seem to work perfectly! Thanks again and If I'm not asking too much from your kindness, could you please explain me how it works and what the code does so I can understand and resolve future similar problem by myself? Will the same code work with 5,6 or n keyframes just changing lines "else if (n < 4)" and "t = key(4).time;" accordingly?

Uber thanks!

Nicola


Return to posts index


Dan Ebberts
Re: Time Remapping 4 Markers control expression
on Apr 5, 2018 at 7:28:02 pm

Yes, in fact, if you changed those two lines like this, it should work for any number of keyframes (as long as the number of markers and the number of keyframes match):


m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
if (n ==0)
t = 0
else if (n < m.numKeys)
t = linear(time,m.key(n).time,m.key(n+1).time,key(n).time,key(n+1).time)
else
t = key(numKeys).time;
valueAtTime(t);


Dan



Return to posts index

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