Copy link to clipboard
Copied
How do I go about clamping a wiggle expression?
I am using the mosaic effect with a wiggle expression on it. The only thing is that I never want the number to become 1, only 2 or higher as with 1 the mosaic effect make vertical lines that I don't want.
Cheers
You could use the linearize function to limit the numbers. You must remember that if you set wiggle to 3, 20 that the wiggle will happen 3 times per second and the value will be between -20 and 20. Also, since you're working with Mosaic you would probably want to round the number of columns. The expression would look like this:
t = wiggle(3, 20);
n = linear(t, -20, 20, 2, 10);
Math.round(n);
This would wiggle the horizontal or vertical block number between 2 and 10 three times a second.
Copy link to clipboard
Copied
You could use the linearize function to limit the numbers. You must remember that if you set wiggle to 3, 20 that the wiggle will happen 3 times per second and the value will be between -20 and 20. Also, since you're working with Mosaic you would probably want to round the number of columns. The expression would look like this:
t = wiggle(3, 20);
n = linear(t, -20, 20, 2, 10);
Math.round(n);
This would wiggle the horizontal or vertical block number between 2 and 10 three times a second.
Copy link to clipboard
Copied
Thank you for your reply, this is great.
Thank You.
Copy link to clipboard
Copied
Rick's linear is a good approach.
If you really just want to clamp you do it like this
var wiggleResult = wiggle(/*your parameters here */);
var clampedWiggleResult = Math.max(2,wiggleResult);
clampedWiggleResult
Copy link to clipboard
Copied
Thank you also for your swift reply.
Cheers