Copy link to clipboard
Copied
Hello
Would like to know if I'm doint anything wrong, because I'm trying to make my shape bounce when morphed, but I get an error message.
How could I solve this issue?
Thank you!
1 Correct answer
This path overshoot expression might be helpful in some situations. It assumes that the number of points doesn't change and it doesn't apply any bounce to the tangents.
freq = 3;
decay = 5;
val = value;
if (numKeys > 0){
n = nearestKey(time).index;
if (time < key(n).time) n--;
if (n > 0){
path = thisProperty;
pNow = path.points(time);
p1 = path.points(key(n).time);
p0 = path.points(key(n).time - thisComp.frameDuration);
p = [];
dur = thisComp.frameDuration;
t = t
...
Copy link to clipboard
Copied
Compound properties such as shape animation cannot be addressed with this kind of expression. Since all the changes to the path are stored in single keyframes, there simply is no way to access velocity for path anchor points. What you seem to want to do would require creating Null objects as path contzrollers and applying the bounce expression to the Nulls' position.
Mylenium
Copy link to clipboard
Copied
Hello
Thanks for help!
Below I have received an expression that really helped me out obtaining the result that I needed.
Have a nice day
Copy link to clipboard
Copied
For a path to bounce, you need keyframes and the graph editor. The Speed graph will give you control over acceleration and at least 4 keyframes are required. Starting Position, Maximum deformation, Resting position created just before Maximum Distortion, then a copy of Resting Position pasted after the Maximum Deformation keyframe. Fiddle with the handles. If you need more than one bounce then you need to set interim keyframes.
Copy link to clipboard
Copied
This path overshoot expression might be helpful in some situations. It assumes that the number of points doesn't change and it doesn't apply any bounce to the tangents.
freq = 3;
decay = 5;
val = value;
if (numKeys > 0){
n = nearestKey(time).index;
if (time < key(n).time) n--;
if (n > 0){
path = thisProperty;
pNow = path.points(time);
p1 = path.points(key(n).time);
p0 = path.points(key(n).time - thisComp.frameDuration);
p = [];
dur = thisComp.frameDuration;
t = time - key(n).time;
for (i = 0; i < p1.length; i++){
amp = (p1[i] - p0[i])/dur;
w = freq*Math.PI*2;
p.push(pNow[i] + amp*(Math.sin((t)*w)/Math.exp(decay*(t))/w));
}
val = createPath(p, path.inTangents(), path.outTangents(), path.isClosed())
}
}
val
Copy link to clipboard
Copied
Great help! Thanks very much
Copy link to clipboard
Copied
Dan, brilliant. If anybody could do it it would be you.

