FORUMS: list search recent posts

pendulum swing at start of layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jeff Nelson
pendulum swing at start of layer
on Mar 30, 2012 at 7:27:14 pm

Hi All,

This should be easy but I can not get this work. I am using the below expression to get a layer (pre comp of a few layers) to swing with decay (you know Dan's old pendulum with decay, or slight modification of it).

The expression makes the layer swing with decay but only at the start of the master composition. I can not off set the layer to start later in the composition, say at 30 seconds in. From my understanding the "startT = thisLayer.startTime" should take care of that.

Here is a screen shot to help explain what I am talking about.


Not that is should matter but I am using CS5.5.

What am I doing wrong? Any help would be greatly appreciated.

Cheers,
jeff

veloc = 7; 
amplitude = 90;
decay = .7; 
startT = thisLayer.startTime;

amplitude*Math.cos(veloc*(time-startT))/Math.exp(decay*time)


variable force, inc
video production/motion graphics durham, nc


Return to posts index

Dan Ebberts
Re: pendulum swing at start of layer
on Mar 30, 2012 at 8:26:52 pm

Try it this way:

veloc = 7;
amplitude = 90
decay = .7;
t = time - inPoint;
amplitude*Math.cos(veloc*t)/Math.exp(decay*t)


Dan



Return to posts index

Jeff Nelson
Re: pendulum swing at start of layer
on Mar 30, 2012 at 8:41:44 pm

Thanks Dan! I am away from that computer now but I will try it Monday, I will let you know if it works.

Question to help me possibly understand:

You have "t" being multiply by both the "veloc" and "decay", but mine only had the "startT" being multiplied by "veloc" is that the problem?

I am trying to understand because I did not come up with the expression, I borrowed it from http://www.macprovideo.com/hub/after-effects/create-swinging-banner-in-afte.... He used exactly what I had and it seemed to work for him. I am just trying to better understand how to control when an expression starts.

Thanks again for your time.

variable force, inc
video production/motion graphics durham, nc


Return to posts index


Dan Ebberts
Re: pendulum swing at start of layer
on Mar 30, 2012 at 8:54:23 pm

Yes, the trick is to replace both references to "time" in the calculation with time-since-in-point. You can use the layer's start time if it's the same as the in point, but I use "inPoint" just in case they're different.

Dan



Return to posts index

Nathan Mallon
Re: pendulum swing at start of layer
on Mar 28, 2013 at 12:41:22 am

Hey! This is almost exactly what I was looking for.

Is there any way to make it so that when the swing dies off, later in the composition I could keyframe it to make it swing again....?

Maybe using a slider? Any help would be appreciated.


Return to posts index

Dan Ebberts
Re: pendulum swing at start of layer
on Mar 28, 2013 at 1:25:45 am

This would trigger the oscillation wherever there's a layer marker:


n = 0;
m = marker;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
t = (n > 0) ? time - m.key(n).time : 0;

veloc = 7;
amplitude = 90
decay = .7;
amplitude*Math.sin(veloc*t)/Math.exp(decay*t)



Dan



Return to posts index


Nathan Mallon
Re: pendulum swing at start of layer
on Mar 28, 2013 at 3:11:37 am

Thanks so much Dan, this is perfect


Return to posts index

Nathan Mallon
Re: pendulum swing at start of layer
on May 2, 2013 at 9:08:23 am

Thanks so much Dan!

At the moment the way this works when I place the marker it triggers but makes the item jump back to the 0 axis point and start from there. Would there be a way to make it i guess trigger but happen dynamically from whatever point in a swing it's at?

Hope that makes sense...

Thanks again!


Return to posts index

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