Activity › Forums › Adobe After Effects Expressions › ValueAtTime + easing, controlled by marker
-
ValueAtTime + easing, controlled by marker
Posted by Justin Crowell on November 8, 2024 at 8:52 pmI’m building a template to allow someone to easily control when a path animates to an end state by adjusting a layer marker.
The path is keyframed and animating constantly, so I thought I would set an end-state keyframe at the end of the timeline and use valueAtTime in the path parameter combined with an easing expression. And this would all be controlled by the time of the layer marker. But I’m struggling to get anything usable.
Does this request make sense? Thanks!
Justin Crowell replied 2 months ago 2 Members · 8 Replies -
8 Replies
-
Justin Crowell
November 8, 2024 at 10:04 pmWow, I’m kind of proud of myself…figured this out on my own! Here is what I used:
markerTime = thisLayer.marker.key(“End”).time;
if (time>=markerTime) {
z = ease(time,markerTime,markerTime+1,markerTime,20);
valueAtTime(z);
}
else {valueAtTime(time);}
-
Justin Crowell
November 8, 2024 at 10:14 pmWhelp…I guess I spoke too soon. It only works if there are no keyframes on the timeline after the marker point. If there ARE keyframes, it kind of bounces back and forth between my easing expression and whatever those keyframes are doing. So it’s super jumpy. I wonder how to ignore those keyframes.
-
Dan Ebberts
November 8, 2024 at 10:45 pmLike this maybe?
markerTime = thisLayer.marker.key("End").time;
val = value;
if (time > markerTime){
val = ease(time,markerTime,markerTime+1,valueAtTime(markerTime),key(numKeys).value);
}
val -
Justin Crowell
November 9, 2024 at 7:05 pmThanks Dan. I think the problem with this is that I’m using ValueAtTime to animate between two paths, which is why I was trying to do it all with the frame number. Looks like I can’t ease between two paths this way.
-
Justin Crowell
November 9, 2024 at 7:48 pmI have a path that is animating constantly with the path parameter itself keyframed. When a certain end-point is triggered, I want that path to smoothly animate to its end-state. And it’s different for each asset I’m doing, so I want to be able to just drag the marker to set that end-point.
I would have done it with scale or something like that, but unfortunately the project was handed to me with animated paths.
-
Dan Ebberts
November 9, 2024 at 8:35 pmAh, OK. That’s a little trickier. This assumes that the number of points on the path doesn’t change, but other than that I think it will work:
markerTime = thisLayer.marker.key("End").time;
if (time > markerTime){
p1 = points(markerTime);
p2 = points(key(numKeys).time);
i1 = inTangents(markerTime);
i2 = inTangents(key(numKeys).time);
o1 = outTangents(markerTime);
o2 = outTangents(key(numKeys).time);
c = isClosed();
p = [];
i = [];
o = [];
for (j = 0; j < p1.length; j++){
p.push(ease(time,markerTime,markerTime+1,p1[j],p2[j]));
i.push(ease(time,markerTime,markerTime+1,i1[j],i2[j]));
o.push(ease(time,markerTime,markerTime+1,o1[j],o2[j]));
}
createPath(p,i,o,c);
}else{
value;
}
Reply to this Discussion! Login or Sign Up