Oscillating circle with Processing

From Knowledge Kitchen
Jump to navigation Jump to search

This example is intended to introduce you to the basics of creating an application in the Processing programming language, a free, open-source language designed specifically to allow artists and creative people to program interactive and visually appealing applications. Processing originated as a project by a few students at the MIT Media Lab. You will quickly notice that the Arduino environment was heavily inspired and based on the Processing environment.

This application creates a Processing application with a circle that bounces up and down a yellow screen.

Screenshot of oscillating circle in processing application

The code

There are lots of built-in variables and functions that are available to you in your Processing programs. Functions used in this example include: setup(), draw(), size(), background(), fill(), and ellipse(). And we use the variables: width, and height. You can see the full list of built-in functions and variables at the Processing website's reference page.

Processing code for oscillating circle


  • What language is Processing based on?
  • In your own words, what is the difference between a global and a local variable?
  • What data type does the draw() function return when it is called?
  • In your own words, explain in detail what the code below the "//keep the circle in bounds" comment does

What links here