Learn creative coding writing simple programs

38. Animate the ocean surface using noise()

Imagine the noise() function is like looking through a hole in a paper. The noise function gives you back a random number depending on the parameters you send. In the case of our paper with a hole, it would return the color we see through the hole, and the parameters actually mean in which direction we are looking through the hole. If we point a little bit up, or a little bit right, the color changes. The same way, if we change the parameters in our noise() function a little bit, the number we get also changes a little bit.
In this episode we use the noise() function with two parameters instead of one. In our example, the first parameter is our current horizontal position and the second parameter is the time. As we slowly change time, the random numbers we get also change, creating something that looks like the surface of the sea.

Tags: animation, noise

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