FORUMS: list search recent posts

How to change "beginTime = thisLayer.inPoint" to keyframe or checkbox?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Stephen Pickering
How to change "beginTime = thisLayer.inPoint" to keyframe or checkbox?
on Mar 13, 2013 at 10:54:13 pm

Hi there,
I have a comp which uses the following expression:

beginTime = thisLayer.inPoint;
if (time < beginTime){
0
}else{
t = time - beginTime;
veloc = [effect("Velocity")("Slider")]*.1;
amplitude = effect("Amplitude")("Slider");
decay = [effect("Decay")("Slider")]*.01;
amplitude*Math.sin(veloc*t)/Math.exp(decay*t) }


It's a pendulum expression from Cineblur. I would like however to not have the sway start at the layer's in point but rather at a keyframe or a "checkbox" I was able to get it to react to a checkbox control(by replacing "thisLayer.inPoint." But because it has a decay expression it begins decaying right away from "inPoint" even though there is no movements until the checkbox was ticked. So basically if I ticked the box at 5 seconds but it has a 7 second decay it only shows subtle movement for 2 seconds, beginning at 5 seconds. Does that make sense?

Any ideas?

Thank you!

-Stephen



Return to posts index

Dan Ebberts
Re: How to change "beginTime = thisLayer.inPoint" to keyframe or checkbox?
on Mar 13, 2013 at 11:16:51 pm

What did you change the first line to? I would think you'd want something like this:

beginTime = effect("Checkbox Control")("Checkbox").key(1).time;

Dan



Return to posts index

Stephen Pickering
Re: How to change "beginTime = thisLayer.inPoint" to keyframe or checkbox?
on Mar 14, 2013 at 3:54:10 am

I believe I had changed it to something like:

beginTime = effect("Checkbox Control")("Checkbox");

But it looks like your expression works. Thank you very much. Can you tell me what the ".key(1).time" does?

Is there any way to make a checkbox that turns it on again? I'm working on a venetian blinds effect. The expression above is for the "sway" which is the result of the blinds closing. The blinds will open and close multiple times so i would need to repeat this decaying pendulum sway multiple times.

Thanks Dan!

-Stephen



Return to posts index


Dan Ebberts
Re: How to change "beginTime = thisLayer.inPoint" to keyframe or checkbox?
on Mar 14, 2013 at 4:14:14 am

key(1).time gives you the time of the first checkbox keyframe.

If you want to trigger it at every checkbox keyframe, you could do it like this:


cb = effect("Checkbox Control")("Checkbox");

n = 0;
if (cb.numKeys > 0){
n = cb.nearestKey(time).index;
if (cb.key(n).time > time) n--;
}
if (n == 0){
0;
}else{
t = time - cb.key(n).time;
veloc = effect("Velocity")("Slider")*.1;
amplitude = effect("Amplitude")("Slider");
decay = effect("Decay")("Slider")*.01;
amplitude*Math.sin(veloc*t)/Math.exp(decay*t)
}



Dan



Return to posts index

Stephen Pickering
Re: How to change "beginTime = thisLayer.inPoint" to keyframe or checkbox?
on Mar 14, 2013 at 4:32:10 am

Works perfectly Dan, Thanks!



Return to posts index

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