I am definitely a beginner when it comes to expressions.
I am currently using a "bounce" expression on the position parameter of some objects as they come on screen. However, the next time they change positions, I don't want them to bounce. Every time a motion tween ends in a static position, the position expression gets applied and the stuff is moving around.
I'd like to be able to keyframe the expression so that it worked only when on the keyframes that it makes sense to affect.
amp = .05;
freq = 1;
decay = 7;
n = 0;
if (numKeys > 0)
{
n = nearestKey(time).index;
if (key(n).time > time)
{
n--;
}
}
if (n == 0)
{
t = 0;
}
else
{
t = time - key(n).time;
}
if (n > 0)
{
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}
else
{
value
}
I got this script from somewhere online. The only thing I know how to manipulate are the initial values of amp, freq, and decay.