Tutorial by Examples

Processing provides a method named line() to draw a line on the screen. This code draws a white 10 pixel line on black background. void setup() { size(500, 500); background(0); stroke(255); strokeWeight(10); } void draw() { line(0, 0, 500, 500); } The signature of m...
Processing provides method rect() to draw a rectangle. This code draws a white 50 X 50 rectangle on black background. void setup() { size(500, 500); background(0); fill(255); noStroke(); } void draw() { rect(225, 225, 50, 50); } The signature of method rect() is thi...
Processing provides method ellipse in order to draw ellipse. This code draws a white circle which has radius of 25 pixels. void setup() { size(500, 500); background(0); fill(255); noStroke(); } void draw() { ellipse(225, 225, 50, 50); } The signature of method ellip...
Processing provides the method triangle in order to draw a triangle. The code below draws a nearly equilateral triangle of 25 pixels between each defining point. void setup() { size(500, 500); background(0); } void draw() { triangle(0, 0, 25, 0, 12, 12); } The signature of tria...
Processing provides method triangle() to draw a triangle. This code draws a white triangle on black background. void setup() { size(500, 500); background(0); fill(255); noStroke(); } void draw() { triangle(250, 225, 225, 275, 275, 275); }

Page 1 of 1