Learn creative coding writing simple programs

37. Make a rectangle dance using noise()

Our second experiment using the noise() function. In this case we make a rectangle move, rotate and resize using several calls to the noise() function. The noise() function takes one parameter. If you call noise() several times and the parameter is identical, you get back the same random number.
In our animation we call noise() five times with different parameters and we also try what happens when the parameters are equal. In that case it feels like the rectangle properties are linked. For example, moving to the right equals to a larger rectangle, or moving to the right means more clockwise rotation.
Try animating also the background color, the fill color, the stroke, and maybe change the different numbers in the program trying to predict which effect your change will produce. Can you make the rectangle move only on the left half of the display?

Tags: noise, random, animation

Code editor

You can make changes to the code below. Then
Below you can ask and answer questions related to this video. If your question is unrelated to the video, please post it at the Processing Forum as I'm unable to help with all of your programs and still have enough free time to eat and sleep :)
comments powered by Disqus