Expressions/Scripts/Presets

Moderators: Disciple, zlovatt

Magua
Topic Author
Posts: 8
Joined: Sat Feb 21, 2009 11:08 pm

### Preserve Initial Layer Position Prior to Wiggle

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
Attachments
Example of the jump
6ans3.gif (1.06 MiB) Viewed 7904 times
Last edited by Magua on Tue Jan 21, 2014 2:28 pm, edited 1 time in total.

Dan Ebberts
Posts: 319
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

### Re: Preserve Initial Layer Position Prior to Wiggle

This should work:

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

Dan

Magua
Topic Author
Posts: 8
Joined: Sat Feb 21, 2009 11:08 pm

### Re: Preserve Initial Layer Position Prior to Wiggle

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?

Dan Ebberts
Posts: 319
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

### Re: Preserve Initial Layer Position Prior to Wiggle

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

Magua
Topic Author
Posts: 8
Joined: Sat Feb 21, 2009 11:08 pm

### Re: Preserve Initial Layer Position Prior to Wiggle

Ah, got it... I didn't understand the syntax then. Thanks so much for the help Dan, it's really appreciated.

Cheers

### Who is online

Users browsing this forum: No registered users and 3 guests