Game by ball 1

Processing is easy to do programming!
You can download it freely from the web site.
It works on Windows and Mac.
It was developed to generate visual arts.
It resembles to other professional programming languages.
It is easy to use a web cam and mouse, libraries by processing.


1. Graphics: Draw a ball

1.1 Generate a window

Alt text
The left: 300x300 window
The right: coordinate. The Y direction is upside down.
The below is code of the above.

size(300,300);

1.2 Change background color

Please add the below code to generate white background.

backrgound(255);// gray scale

Then, change it to the below.

backrgound(255,0,0);// Red, Green, Blue

Color values can be indicated from 0 to 255.

Alt text

Additive color mixture is general in CG,

Alt text

Ex A:RGB Color.

  1. Please look such web site and find your favorite color in RGB color space.
  2. Change color using the above code.

1.3 Draw a ball

See the official web site.

Ex B: Draw two balls on different positions.

2. Animate a ball

2.1 setup() and draw()

See the web site for setup().

See the web site for draw().

See the web site for println().

Let’s use println() in setup(){} and draw(){}
and see what happens in a console window (black one).

void setup(){
size(300,300);
println("set");
}
void draw()
{
println("draw");
}

2.2 Move a ball by draw()

Ex B: