Activity › Forums › Adobe After Effects Expressions › Wiggle, but never go past set minimum.
-
Wiggle, but never go past set minimum.
Posted by Navarro Parker on June 26, 2014 at 5:28 pmI put a wiggle on a Shape Layer’s Trim Path End parameter that’s at 50%. I only want to wiggle values greater than 50 (I never want it to go below 50).
I tried this:
n=wiggle(1,10);
value + nBut it always gives me 100%. What am I doing wrong?
Dan Ebberts replied 12 years, 1 month ago 3 Members · 11 Replies -
11 Replies
-
Dan Ebberts
June 26, 2014 at 5:35 pmYou could try something like this:
amp = 5;
w = wiggle(1,amp) – value;
value + amp + wDan
-
Dan Ebberts
June 26, 2014 at 6:18 pmI didn’t need to make it so complicated. This does the same thing:
amp = 5;
wiggle(1,amp) + amp;Dan
-
Navarro Parker
June 26, 2014 at 6:44 pmFantastic!
Similarly, how can I tell a wiggle to stay between a min and max value?
Traditionally, if I want to wiggle between 50~75%, I’d set the starting value at the midpoint (75-50)÷2+50 then set the amp value to (75-50)÷2. Math!
It would be handy to directly set min and max values, but have the normal controls over wiggle (freq,amp,octave,seed). This is of course for 1-dimensional parameters like rotation and sliders.
-
Kevin Camp
June 26, 2014 at 11:06 pmthat’s pretty much how you’d do it… you could simplify the math a bit, like this:
min=50;
max=75;
freq=5;
oct=5;
min+Math.abs(wiggle(freq,max-min,oct))Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
Navarro Parker
June 27, 2014 at 1:31 amThis doesn’t seem to be working correctly on a Shape Layer’s Trim Paths which goes from 0~100%.
Your expression pegs the parameter at 100%. It never goes under.
I removed the first ‘min’ from last line and just used this which got me closer:
Math.abs(wiggle(freq,max-min,oct))I set it to wiggle between 54~71, but I’m getting values near 78%.
-
Kevin Camp
June 27, 2014 at 7:53 pmtrim paths probably needs to be set to 0… wiggle still uses the value of the property.
i’ll take a look when i get a chance.
Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
Kevin Camp
June 27, 2014 at 7:58 pmi’m rendering right now, but if you can, you might try changing the last line to this:
min+Math.abs(wiggle(freq,max-min,oct))-value
Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
Kevin Camp
June 27, 2014 at 8:26 pmnope, that won’t work… i think about it a bit more, but i don’t think we can get around having to set the base value to 0.
Kevin Camp
Art Director
KCPQ, KZJO & KRCW -
Dan Ebberts
June 27, 2014 at 8:39 pmYou can do it by having the wiggle reference a property that doesn’t get clipped (like rotation):
min = 25;
max = 75;
freq = 1;
amp = (max-min)/2;
w = rotation.wiggle(freq,amp)-rotation;
(min+max)/2 + wDan
-
Navarro Parker
July 14, 2014 at 11:45 pmI’m trying your expression to make an object only scale in one axis. But I’m getting “Class number has no property named 0” error
min = 25;
max = 75;
freq = 1;
amp = (max-min)/2;
w = rotation.wiggle(freq,amp)-rotation;
[(min+max)/2 + w[0],value[1]];
Reply to this Discussion! Login or Sign Up