ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Adding Inertia or Bounce on a Shape Layers Path?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Ryan Cuppernull
Adding Inertia or Bounce on a Shape Layers Path?
on Aug 19, 2015 at 6:31:43 pm

I was wondering if it is possible to add an intertial bounce to the the path property of a shape layer?

I have a shape layer with one filled path within a group, I have animated the path property of this shape to grow and want to add an intertial bounce (or any bounce) to this growth. When I try to add the expression, I receive the error "After Effects error: can't compute derivative to a non-spatial custom value ( 29 :: 57 )".

I did some digging and could only find this thread about using expressions on paths, and am wondering if there is a way to make my path bounce via expressions.

The expression I am trying is from here, and I've included it in the post as well. Thanks for any help!

amp = .1;
freq = 2.0;
decay = 2.0;
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 && t &lt; 1){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{value}


Return to posts index

Dan Ebberts
Re: Adding Inertia or Bounce on a Shape Layers Path?
on Aug 19, 2015 at 7:30:04 pm

I don't think there's a good way to get there with expressions because expressions can't do any math on paths. You can link to other paths and use valueAtTime(), but that's pretty much it.

Dan



Return to posts index

Ryan Cuppernull
Re: Adding Inertia or Bounce on a Shape Layers Path?
on Aug 20, 2015 at 1:39:53 pm

Gotcha. Thanks for the confirmation on that. I wonder if it is a technical limitation in scripting, or if it could be a feature request.

Thanks for the help!


Return to posts index


Santi Agustí
Re: Adding Inertia or Bounce on a Shape Layers Path?
on Mar 22, 2018 at 11:50:57 pm

Hi!
sorry for bringing back this old post,
do you think it's now possible to add bounciness to a shape layer path animation with the new cc 2018 features?


Return to posts index

Dan Ebberts
Re: Adding Inertia or Bounce on a Shape Layers Path?
on Mar 23, 2018 at 6:25:17 am

Yes, it seems to work. It simplifies things if you can assume that the tangents remain constant and that the number of points doesn't change. Something like this should work:


n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if(key(n).time > time) n--;
}
if (n > 0){
p0 = thisProperty.points(key(n).time - thisComp.frameDuration/10);
p1 = thisProperty.points(key(n).time);
p = [];
pCur = thisProperty.points();
t = time - key(n).time;
freq = 3.0;
decay = 5.0;
m = Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
for (i = 0; i < p0.length; i++){
v = (p1[i] - p0[i])*10*m;
p.push(pCur[i] + v);
}
createPath(p,thisProperty.inTangents(),thisProperty.outTangents(),thisProperty.isClosed());
}else
value



Dan



Return to posts index

Santi Agustí
Re: Adding Inertia or Bounce on a Shape Layers Path?
on Mar 23, 2018 at 7:55:55 am

totally awesome, thanks!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]