Activity › Forums › Adobe After Effects Expressions › Markers to control position In
-
Markers to control position In
Posted by Nathaniel Logan on January 25, 2019 at 4:11 amHi,
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.
ThanksNathaniel Logan replied 7 years, 6 months ago 2 Members · 4 Replies -
4 Replies
-
Dan Ebberts
January 25, 2019 at 5:33 amSomething 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
-
Nathaniel Logan
January 25, 2019 at 11:47 amHi 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 🙂 -
Dan Ebberts
January 25, 2019 at 5:01 pmSomething 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
-
Nathaniel Logan
January 25, 2019 at 5:38 pmWonderful Dan, this script works like Charm, you’re the best of the best.
Thank you so much, ☺ ☺ ☺
Reply to this Discussion! Login or Sign Up