Page 1 of 1

Preserve Initial Layer Position Prior to Wiggle

Posted: January 21st, 2014, 2:19 pm
by Magua
Hi All,
I'm a bit of a beginner in expressions, but I'm looking for a way to keep the initial position of a layer when adding a wiggle expression to it. Let me try and illustrate what I'm meaning. Basically, say I have a circular shape layer at position 960,540 (centered). When I add the expression "wiggle(.5,100)" and apply it, the circle immediately jumps to another random position within the range of those 100 pixels (say 988,522). What I'm looking to do is be able to add that same expression, and have it continue it's random motion, but start initially from the position of 960,540 so that there's no jump when activating it. I'm aware of "valueAtTime" condition, but am unsure how to use it or if there's another/better/easier way to implement what I'm looking for (maybe just using "value")? Thanks for the help.

Magua

Re: Preserve Initial Layer Position Prior to Wiggle

Posted: January 21st, 2014, 2:27 pm
by Dan Ebberts
This should work:

freq = .5;
amp = 100;
wiggle(freq,amp) - wiggle(freq,amp,1,.5,inPoint) + value


Dan

Re: Preserve Initial Layer Position Prior to Wiggle

Posted: January 21st, 2014, 2:36 pm
by Magua
Wow, lightning fast reply Dan. Yep, this works perfectly - thanks a lot, I really appreciate it. I'm wondering if you don't mind walking me through a portion of this expression though, just so I understand it. I get everything up until "wiggle(freq,amp,1,.5,inPoint)" in the third line, and more specifically, the "1,.5" portion of this. My understanding is that overall, the expression is negating the offset from it's inpoint value, but I'm not following those two values... especially the "1"... I ask in case I want to change/tweak the amplitude and frequency overall... Thanks in advance.

Cheers


EDIT: Ok, asked this before researching it. My understanding that those are the octave and amp_mult values. The octave makes sense to keep defaulted to 1 and my guess is that you want the amp_mult to match the frequency I'm using. I guess my question would then be, why even bother to define the octave if you're keeping it at the default... unless you need to pair the octave and amp_mult values?

Re: Preserve Initial Layer Position Prior to Wiggle

Posted: January 21st, 2014, 2:49 pm
by Dan Ebberts
To get to wiggle's 5th parameter (time--which is how you accomplish valueAtTime for wiggle), you have to specify something for the 3rd and 4th parameters (number of octaves and octave amplitude multiplier) so I just plug in the defaults (1 and .5).


Dan

Re: Preserve Initial Layer Position Prior to Wiggle

Posted: January 21st, 2014, 2:53 pm
by Magua
Ah, got it... I didn't understand the syntax then. Thanks so much for the help Dan, it's really appreciated.

Cheers