Learn creative coding writing simple programs

77. A 3D rotating cloud of points

In episode 63 we saw how to create a rotating box(). It was our first 3D experiment. This time we create a rotating box(), but we fill it with points floating in the air. The position of all the points is pre-calculated when the program starts, inside the setup() function. There we fill three arrays with random numbers. We need those numbers to stay the same between calls to the draw() function. That's why we need to "memorize" all the points: we create random position for many points, and we store those positions in three arrays. Later, each time we call draw(), we use the information saved in those arrays to draw the same points over and over. The reason why they appear to move even when we draw them on the same exact locations is that we are using the rotateY() function to rotate everything we draw by a certain amount, and this amount is continuously increasing.

Tags: rotatey, animate, point, cloud, points

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