Skip to main content
Inspiring
May 28, 2015
Answered

clamp a wiggle expression

  • May 28, 2015
  • 2 replies
  • 5920 views

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

This topic has been closed for replies.
Correct answer Rick Gerard

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.

2 replies

Mathias Moehl
Community Expert
Community Expert
May 28, 2015

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

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects
Inspiring
May 29, 2015

Thank you also for your swift reply.

Cheers

Rick GerardCommunity ExpertCorrect answer
Community Expert
May 28, 2015

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.

Inspiring
May 29, 2015

Thank you for your reply, this is great.

Thank You.