Activity › Forums › Adobe After Effects Expressions › Min & Max Values
-
Min & Max Values
Posted by Isaac Tallack on February 4, 2012 at 3:28 pmHey guys,
I have the expression: ‘wiggle(7,21)’ from my understanding the first number (7) controls the time between wiggles and the second number (21) controls the amount of wiggle. < Please correct me if that is wrong. I want to be able to set the min and max of the wiggle like 15-21 or something. Can anyone tell me how I would go about that.
Thanks in advance,
IsaacKeith Endow replied 5 years, 3 months ago 5 Members · 11 Replies -
11 Replies
-
Dan Ebberts
February 4, 2012 at 5:24 pmFor a one-dimensional property (like rotation), you could do it like this:
minVal = 15;
maxVal = 21;
w = wiggle(7,1)-value;
value + linear(w,-1,1,minVal,maxVal)It would be a little more complex for multi-dimensional properties, but the concept is the same.
Dan
-
Ruben Langedijk
September 16, 2016 at 10:39 amHi Dan , Thanks for all the scripts you provide.
do you have an idea how to combine this one with your looping script?
freq = 1;
amp = 110;
loopTime = 3;
t = time % loopTime;
wiggle1 = wiggle(freq, amp, 1, 0.5, t);
wiggle2 = wiggle(freq, amp, 1, 0.5, t – loopTime);
linear(t, 0, loopTime, wiggle1, wiggle2) -
Dan Ebberts
September 16, 2016 at 1:05 pmTry this:
minVal = 15;
maxVal = 21;
freq = 1;
amp = 110;
loopTime = 3;
t = time % loopTime;
w1 = wiggle(freq, 1, 1, 0.5, t)-value;
w2 = wiggle(freq, 1, 1, 0.5, t – loopTime)-value;
w = linear(t, 0, loopTime, w1, w2);
(minVal+maxVal)/2 + (maxVal-minVal)*wDan
-
Mike Douglas
February 7, 2017 at 12:03 amHi there, that’s a really useful expression. How would you modify it to only work for a single dimension (eg: X position)? Thanks in advance!
-
Dan Ebberts
February 7, 2017 at 12:31 amSomething like this should work:
minVal = 100;
maxVal = 200;
freq = 1;
amp = 110;
loopTime = 3;
t = time % loopTime;
w1 = wiggle(freq, 1, 1, 0.5, t)-value;
w2 = wiggle(freq, 1, 1, 0.5, t – loopTime)-value;
w = linear(t, 0, loopTime, w1, w2);
x = (minVal+maxVal)/2 + (maxVal-minVal)*w[0];
[x,value[1]]Dan
-
Mike Douglas
February 7, 2017 at 1:19 amGreat! Thanks Dan for the quick response.
That mostly works – it loops and only affects X, but the min/max is not working. It goes outside of the parameters that I set (I set it to min 0, max 250, and it’s going both into negative numbers and above 250. Any thoughts as to why?
Thanks!
-
Dan Ebberts
February 7, 2017 at 1:27 amIt’s hard to corral wiggle() precisely. You probably need to set your limits to something like 50 and 200.
Dan
-
Mike Douglas
February 7, 2017 at 1:38 amThanks Dan! That’s perfect. That works just fine.
BTW, I just posted another question about a different expression I’m puzzling over. If you had a second to look it over, that’d be greatly appreciated! https://forums.creativecow.net/thread/227/34955
-
Keith Endow
January 29, 2021 at 6:24 pmHi Dan,
I just tried using this expression but I keep coming up with an error:
minVal = 15;
maxVal = 21;
freq = 1;
amp = 110;
loopTime = 3;
t = time % loopTime;
w1 = wiggle(freq, 1, 1, 0.5, t)-value;
w2 = wiggle(freq, 1, 1, 0.5, t – loopTime)-value;“Error: Syntaxerror: Missing ) after argument list”
w = linear(t, 0, loopTime, w1, w2);
(minVal+maxVal)/2 + (maxVal-minVal)*w -
Dan Ebberts
January 29, 2021 at 6:34 pmCould you try posting your expression again, this time in a preformatted text box (first click the Aa at the bottom, then the </>)? When you just paste it in, things get modified. For example, your error line has the wrong character for the minus sign. That might be your problem, or it might just be an artifact of the web page formatting.
Reply to this Discussion! Login or Sign Up