ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Markers to control position In

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nathaniel Logan
Markers to control position In
on Jan 25, 2019 at 4:11:49 am

Hi,

I was wondering is it possible to trigger layer position animation from a marker.

So the position keyframes are already set but the animation should start only when the marker begins on the same layer.

Can anyone help me on this expression.

Much appreciated.
Thanks


Return to posts index

Dan Ebberts
Re: Markers to control position In
on Jan 25, 2019 at 5:33:34 am

Something like this probably:


m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
t = n > 0 ? time - m.key(n).time : 0;
valueAtTime(key(1).time + t)



Dan



Return to posts index

Nathaniel Logan
Re: Markers to control position In
on Jan 25, 2019 at 11:47:39 am

Hi Dan the above snippet works like Charm thank you so much ☺

Also went through one of your script that triggers the Animation In/Out whichever the 3rd Keyframe is...

outKey = 3;
if (time > key(outKey-1).time){
m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
t = n > 0 ? time - m.key(n).time : 0;
valueAtTime(key(outKey).time + t);
}else{
value;
}

But is it possible to add two markers for a layer and keyframe the Position and Connect the first two keyframes to "In" Marker and next Two keyframes to "Out" Marker.

Much appreciated.
Thanks :)


Return to posts index


Dan Ebberts
Re: Markers to control position In
on Jan 25, 2019 at 5:01:50 pm

Something like this maybe:



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




Dan



Return to posts index

Nathaniel Logan
Re: Markers to control position In
on Jan 25, 2019 at 5:38:21 pm

Wonderful Dan, this script works like Charm, you're the best of the best.

Thank you so much, ☺ ☺ ☺


Return to posts index

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