Learn creative coding writing simple programs

46. Create beautiful curves with lots of sin() calls

Now we use the sin() function to control many different properties. We animate circles moving on the screen. Their X and Y position is calculated using the sine function. The size, hue and brightness of each circle is also calculated with different formulas that use sin(). This trigonometric function by default gives a very simple and predictable result. But when we combine multiple sin() calls we can get more complex graphics, but which still change in a smooth way.

Tags: sin, graphics, trigonometry, math, draw, animate, animation

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); } ```