FORUMS: list search recent posts

Random Number Counter with expression slider not pass zero

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Bert Beltran
Random Number Counter with expression slider not pass zero
on Oct 28, 2013 at 6:32:34 pm

I have an text layer were the source text is parent to a expression slider. The expression looks like this:
Math.round(effect("Slider Control")("Slider")). Then I added a wiggle expression to the slider control, but my issues is that the wiggle expression sometimes runs into negative numbers and I want to set the minimum value to Zero.

I tried this expression that came close to doing what I wanted it to do but there are times it will jump to a negative number.

Math.min=0;
wiggle(1,50)

Last thing how would I create an expression so that it has a max limit number as well. So that it did not pass the number 100. So it would count random numbers from 0 to 99.

Muchos Thank You's


Return to posts index

Kevin Camp
Re: Random Number Counter with expression slider not pass zero
on Oct 28, 2013 at 6:44:53 pm

Math.min() and Math.max() need two values (unless they assume zero as one value if only one value is present).

so for your first expression you'd want something like this:

w = wiggle(1,50);
Math.max(0,w)

you'd use Math.max() since you want it to return zero if w is less than zero.

to values to a range (0-99), you'd use both Math.min() and Math.max(), and you can embed one inside the other:

w = wiggle(1,50);
Math.max(0,Math.min(99,w))

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index

Kevin Camp
Re: Random Number Counter with expression slider not pass zero
on Oct 31, 2013 at 9:33:17 pm

clamp() would also work here...

w = wiggle(1,50);
clamp(w,0,99)

Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW


Return to posts index

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