Learn creative coding writing simple programs

11. Non-random animation of a circle crossing the screen

We first review the ellipse() function and then animate a circle from the left to the right border of the screen. We use a variable to hold the current position of the circle. For doing random animation we don't need a variable because we don't need to know the last position of the object. But for animating an object moving in one direction, we need to know where we are now to know where we will be next. That's why we store the current position in a variable.

This episode was a bit too long and serious. The next one should be shorter and more fun :)

Tags: animation, help

Code editor

You can make changes to the code below. Then

Questions and comments

Try to stay close to the topic of this episode. Use the Processing forums for help with unrelated Processing projects (or hire me for help ;-)

To indicate that a word in your comment is code, use the `backtick`. Example
Do `float` and `int` smell similar?
To highlight code blocks, surround it with ``` code-fences ``` like this:
``` void setup() { size(600, 600); } ```