ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Min & Max Values

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Isaac Tallack
Min & Max Values
on Feb 4, 2012 at 3:28:04 pm

Hey 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,
Isaac


Return to posts index

Dan Ebberts
Re: Min & Max Values
on Feb 4, 2012 at 5:24:53 pm

For 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



Return to posts index

ruben Langedijk
Re: Min & Max Values
on Sep 16, 2016 at 10:39:07 am

Hi 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)


Return to posts index


Dan Ebberts
Re: Min & Max Values
on Sep 16, 2016 at 1:05:10 pm

Try 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)*w

Dan



Return to posts index

Mike Douglas
Re: Min & Max Values
on Feb 7, 2017 at 12:03:54 am

Hi 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!


Return to posts index

Dan Ebberts
Re: Min & Max Values
on Feb 7, 2017 at 12:31:23 am

Something 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



Return to posts index


Mike Douglas
Re: Min & Max Values
on Feb 7, 2017 at 1:19:41 am

Great! 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!


Return to posts index

Dan Ebberts
Re: Min & Max Values
on Feb 7, 2017 at 1:27:09 am

It's hard to corral wiggle() precisely. You probably need to set your limits to something like 50 and 200.


Dan



Return to posts index

Mike Douglas
Re: Min & Max Values
on Feb 7, 2017 at 1:38:59 am

Thanks 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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]