Activity › Forums › Adobe After Effects Expressions › Wiggle only negative values
-
Wiggle only negative values
Posted by Navarro Parker on June 15, 2015 at 5:27 pmI have a shape layer that I have drawn at it’s maximum length. I want to wiggle the scale in Y only — but only subtract wiggle values so it never exceeds the maximum length.
Tried modifying a pervious expression, but got an error:
myWiggle = wiggle(2,75);
delta = Math.abs( myWiggle - value[1] );
[value[0],value - delta[1]]
Navarro Parker replied 10 years, 7 months ago 2 Members · 8 Replies -
8 Replies
-
Dan Ebberts
June 15, 2015 at 5:52 pmTry this:
myWiggle = Math.abs(wiggle(2,75)[1]-value[1]);
value – [0,myWiggle]Dan
-
Navarro Parker
June 15, 2015 at 6:25 pm -
Dan Ebberts
June 15, 2015 at 6:42 pmwiggle() can sometimes go over the amplitude amount. Try it this way:
myWiggle = clamp(Math.abs(wiggle(2,75)[1]-value[1]),0,100);
value – [0,myWiggle]Dan
-
Navarro Parker
January 21, 2016 at 3:20 amHi Dan!
I’ve revisited this expression today. And I’ve noticed a funky situation. I’m using a low freq (.25) and I get this weird “bounce” when the wiggle reaches the maximum value. It doesn’t gracefully flow from a low value to a high value to a low value.
It reaches the maximum and then immediately bounces backward like it hits a wall. I’d describe it as “triangle” interpolation.
I’m using an octave of 1 in hopes to get the most flowy, gentle wiggle.
Any ideas how to smooth this expression out so there’s more of a gentle sine-y interpolation between min and max values?
-
Navarro Parker
January 21, 2016 at 3:40 am -
Dan Ebberts
January 21, 2016 at 5:18 amI don’t know of a really good way to do what you’re trying to do, due to the unpredictability of wiggle’s peak values. I’ve seen peak values 33% higher than the specified value. You can use Math.abs to fold the wave back on itself, but as you’ve seen, that creates sharp corners. You could clamp it, but that creates flat spots. You could connect the amplitude and an offset to sliders so you can adjust your specific waveform to fit perfectly within your limits. You can automate the whole thing with a script. Or, if your comp isn’t too long you can use an expression that first finds the min and max values of the entire wave (from inPoint to outPoint) and use those values to fit the waveform within your desired range. If it bogs down (because at each frame it has to examine all frames), you could convert the expression to keyframes. Play around with this opacity expression:
targetMin = 20;
targetMax = 100;t = inPoint;
min = 1.5;
max = -1.5;
while (t < outPoint){
w = rotation.wiggle(.25,1,1,.5,t)-rotation.valueAtTime(t);
min = Math.min(w,min);
max = Math.max(w,max);
t += thisComp.frameDuration;
}
w = rotation.wiggle(.25,1) - rotation;
linear(w,min,max,targetMin,targetMax)
Dan
-
Navarro Parker
January 21, 2016 at 8:24 pm
Reply to this Discussion! Login or Sign Up

