Creating ellipses with different colours and sizes

You need to check to the reference and become familiar with the following entries:

  • draw()
  • setup()
  • color
  • color()
  • size()
  • Both width and height entries

You can find also lots of inspirations exploring the examples either available in the Processing Development Environment (PDE) or in the Processing site.

To change color, you need to know that the default color mode is rgb: red, green and blue. To generate any color, you need to use the rgb codes together. For instance: color(255,0,0) gives you red as green and blue are 0. You need to know that by default, the color range goes from 0 to 255 (although that can be change).

If you try something like this: fill(random()*255,0,0) and then you draw an ellipse, the ellipse will be filled with different shades of red as the random() function returns a number from 0 to 1, so random()*255 will return a value from 0 to 255. This value is updated every time the draw() function is executed, at a rate of 60 fps.

Kf

2 Likes