FORUMS: list search recent posts

Trying to delay multiple expressions but getting strange results....

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
martin van der linden
Trying to delay multiple expressions but getting strange results....
on Dec 18, 2012 at 6:54:35 am

I am trying to animate a bunch of layers (13 ) swinging (rotation) independently. The expression below is added to the layers' rotation property and works fine if the delay is set to 0. However if I set the delay for one layer to another value (like 1 or 2) the animation indeed waits 1 or 2 seconds and then seems to jump into the same wave or rythim as the other layers. It does not start smoothly. Looks almost like there is only one sine wave going and no matter what time the code excutes it always jumps onto the same wave as the rest. I'm assuming it has something to do with comp time being part of the equation but my math is not good enough to find an alternative ;)
If I precomp every layer independently and then combine them in another comp I cant move the layers forward in time - because of the expressions, I think? So....any tips?

TIA,

Martin

timeToStart = effect("Delay")(1);//linked to a slider control
if (time > timeToStart){
freq = .75;
amplitude = 50;
decay = .75;
amplitude*Math.sin(freq*time*2*Math.PI)/Math.exp(decay*time)

}else{
value;
}


Return to posts index

Dan Ebberts
Re: Trying to delay multiple expressions but getting strange results....
on Dec 18, 2012 at 1:30:51 pm

Try replacing this line:

amplitude*Math.sin(freq*time*2*Math.PI)/Math.exp(decay*time)

with these:

t = time - timeToStart;
amplitude*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t)



Dan



Return to posts index

martin van der linden
Re: Trying to delay multiple expressions but getting strange results....
on Dec 19, 2012 at 1:28:58 am

Works like a charm! Now does exactly what I wanted. I seriously have to to brush up on my math though... :)

Thanks very much for your help Dan.

Martin


Return to posts index

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