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

Tue Jan 21, 2014 2:19 pm

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
6ans3.gif
Example of the jump
6ans3.gif (1.06 MiB) Viewed 4605 times
Last edited by Magua on Tue Jan 21, 2014 2:28 pm, edited 1 time in total.
 
Dan Ebberts
Posts: 318
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Preserve Initial Layer Position Prior to Wiggle

Tue Jan 21, 2014 2:27 pm

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

Tue Jan 21, 2014 2:36 pm

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: 318
Joined: Sat Jun 26, 2004 10:01 am
Location: Folsom, CA
Contact:

Re: Preserve Initial Layer Position Prior to Wiggle

Tue Jan 21, 2014 2:49 pm

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

Tue Jan 21, 2014 2:53 pm

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 1 guest