-
Adding Wiggle to Dan Ebbert’s Keyframe Overshoot Expression
How to make the property (in my case, position) wiggle? I’ve got a few hundred layers with two keyframes in the position property, all with Dan Ebbert’s expression applied. I want each layer to be wiggling after it has settled (kind of like something zooming through water and then coming to a sudden halt and then drifting around lightly).
Thinking about it, the movement between the two keyframes for the layers in my comp are so quick that it doesn’t need to wiggle AFTER it has settled. The position value can be wiggling the whole time because no one will notice it while the layers are moving in my comp. Basically, it’s like I need two expressions: the Keyframe Overshoot expression and a Wiggle applied at the same time, but I just don’t know enough to make them play together.
In the past I’ve solved this problem in a less-elegant way by simply creating a null as a parent and then putting the wiggle on the parent, but in this particular comp I’m dealing with hundreds of layers and would rather just apply an expression to each one’s position property. Here’s in Dan’s code in case you’re not familiar with it already from his site (https://www.motionscript.com/articles/bounce-and-overshoot.html). How do I get a wiggle in there?
freq = 3; decay = 5; n = 0; if (numKeys > 0){ n = nearestKey(time).index; if (key(n).time > time) n--; } if (n > 0){ t = time - key(n).time; amp = velocityAtTime(key(n).time - .001); w = freq*Math.PI*2; value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w); }else value