mirror of
https://github.com/processing/processing4.git
synced 2026-02-02 21:29:17 +01:00
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
// Example 03-01 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(800, 600);
|
||||
@@ -0,0 +1,5 @@
|
||||
// Example 03-02 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
point(240, 60);
|
||||
@@ -0,0 +1,5 @@
|
||||
// Example 03-03 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
line(20, 50, 420, 110);
|
||||
@@ -0,0 +1,7 @@
|
||||
// Example 03-04 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
quad(158, 55, 199, 14, 392, 66, 351, 107);
|
||||
triangle(347, 54, 392, 9, 392, 66);
|
||||
triangle(158, 55, 290, 91, 290, 112);
|
||||
@@ -0,0 +1,5 @@
|
||||
// Example 03-05 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
rect(180, 60, 220, 40);
|
||||
@@ -0,0 +1,7 @@
|
||||
// Example 03-06 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
ellipse(278, -100, 400, 400);
|
||||
ellipse(120, 100, 110, 110);
|
||||
ellipse(412, 60, 18, 18);
|
||||
@@ -0,0 +1,8 @@
|
||||
// Example 03-07 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
arc(90, 60, 80, 80, 0, HALF_PI);
|
||||
arc(190, 60, 80, 80, 0, PI+HALF_PI);
|
||||
arc(290, 60, 80, 80, PI, TWO_PI+HALF_PI);
|
||||
arc(390, 60, 80, 80, QUARTER_PI, PI+QUARTER_PI);
|
||||
@@ -0,0 +1,8 @@
|
||||
// Example 03-08 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
arc(90, 60, 80, 80, 0, radians(90));
|
||||
arc(190, 60, 80, 80, 0, radians(270));
|
||||
arc(290, 60, 80, 80, radians(180), radians(450));
|
||||
arc(390, 60, 80, 80, radians(45), radians(225));
|
||||
@@ -0,0 +1,8 @@
|
||||
// Example 03-09 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
ellipse(140, 0, 190, 190);
|
||||
// The rectangle draws on top of the ellipse
|
||||
// because it comes after in the code
|
||||
rect(160, 30, 260, 20);
|
||||
@@ -0,0 +1,8 @@
|
||||
// Example 03-10 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
rect(160, 30, 260, 20);
|
||||
// The ellipse draws on top of the rectangle
|
||||
// because it comes after in the code
|
||||
ellipse(140, 0, 190, 190);
|
||||
@@ -0,0 +1,8 @@
|
||||
// Example 03-11 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth(); // Turns on smoothing
|
||||
ellipse(140, 60, 90, 90);
|
||||
noSmooth(); // Turns off smoothing
|
||||
ellipse(240, 60, 90, 90);
|
||||
@@ -0,0 +1,11 @@
|
||||
// Example 03-12 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
ellipse(75, 60, 90, 90);
|
||||
strokeWeight(8); // Stroke weight to 8 pixels
|
||||
ellipse(175, 60, 90, 90);
|
||||
ellipse(279, 60, 90, 90);
|
||||
strokeWeight(20); // Stroke weight to 20 pixels
|
||||
ellipse(389, 60, 90, 90);
|
||||
@@ -0,0 +1,14 @@
|
||||
// Example 03-13 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
strokeWeight(12);
|
||||
strokeJoin(ROUND); // Round the stroke corners
|
||||
rect(40, 25, 70, 70);
|
||||
strokeJoin(BEVEL); // Bevel the stroke corners
|
||||
rect(140, 25, 70, 70);
|
||||
strokeCap(SQUARE); // Square the line endings
|
||||
line(270, 25, 340, 95);
|
||||
strokeCap(ROUND); // Round the line endings
|
||||
line(350, 25, 420, 95);
|
||||
@@ -0,0 +1,12 @@
|
||||
// Example 03-14 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
background(0); // Black
|
||||
fill(204); // Light gray
|
||||
ellipse(132, 82, 200, 200); // Light gray circle
|
||||
fill(153); // Medium gray
|
||||
ellipse(228, -16, 200, 200); // Medium gray circle
|
||||
fill(102); // Dark gray
|
||||
ellipse(268, 118, 200, 200); // Dark gray circle
|
||||
@@ -0,0 +1,11 @@
|
||||
// Example 03-15 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
fill(153); // Medium gray
|
||||
ellipse(132, 82, 200, 200); // Gray circle
|
||||
noFill(); // Turn off fill
|
||||
ellipse(228, -16, 200, 200); // Outline circle
|
||||
noStroke(); // Turn off stroke
|
||||
ellipse(268, 118, 200, 200); // Doesn’t draw!
|
||||
@@ -0,0 +1,13 @@
|
||||
// Example 03-16 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
noStroke();
|
||||
smooth();
|
||||
background(0, 26, 51); // Dark blue color
|
||||
fill(255, 0, 0); // Red color
|
||||
ellipse(132, 82, 200, 200); // Red circle
|
||||
fill(0, 255, 0); // Green color
|
||||
ellipse(228, -16, 200, 200); // Green circle
|
||||
fill(0, 0, 255); // Blue color
|
||||
ellipse(268, 118, 200, 200); // Blue circle
|
||||
@@ -0,0 +1,13 @@
|
||||
// Example 03-17 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
noStroke();
|
||||
smooth();
|
||||
background(204, 226, 225); // Light blue color
|
||||
fill(255, 0, 0, 160); // Red color
|
||||
ellipse(132, 82, 200, 200); // Red circle
|
||||
fill(0, 255, 0, 160); // Green color
|
||||
ellipse(228, -16, 200, 200); // Green circle
|
||||
fill(0, 0, 255, 160); // Blue color
|
||||
ellipse(268, 118, 200, 200); // Blue circle
|
||||
@@ -0,0 +1,13 @@
|
||||
// Example 03-18 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
beginShape();
|
||||
vertex(180, 82);
|
||||
vertex(207, 36);
|
||||
vertex(214, 63);
|
||||
vertex(407, 11);
|
||||
vertex(412, 30);
|
||||
vertex(219, 82);
|
||||
vertex(226, 109);
|
||||
endShape();
|
||||
@@ -0,0 +1,13 @@
|
||||
// Example 03-19 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
beginShape();
|
||||
vertex(180, 82);
|
||||
vertex(207, 36);
|
||||
vertex(214, 63);
|
||||
vertex(407, 11);
|
||||
vertex(412, 30);
|
||||
vertex(219, 82);
|
||||
vertex(226, 109);
|
||||
endShape(CLOSE);
|
||||
@@ -0,0 +1,38 @@
|
||||
// Example 03-20 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
|
||||
// Left creature
|
||||
beginShape();
|
||||
vertex(50, 120);
|
||||
vertex(100, 90);
|
||||
vertex(110, 60);
|
||||
vertex(80, 20);
|
||||
vertex(210, 60);
|
||||
vertex(160, 80);
|
||||
vertex(200, 90);
|
||||
vertex(140, 100);
|
||||
vertex(130, 120);
|
||||
endShape();
|
||||
fill(0);
|
||||
ellipse(155, 60, 8, 8);
|
||||
|
||||
// Right creature
|
||||
fill(255);
|
||||
beginShape();
|
||||
vertex(370, 120);
|
||||
vertex(360, 90);
|
||||
vertex(290, 80);
|
||||
vertex(340, 70);
|
||||
vertex(280, 50);
|
||||
vertex(420, 10);
|
||||
vertex(390, 50);
|
||||
vertex(410, 90);
|
||||
vertex(460, 120);
|
||||
endShape();
|
||||
fill(0);
|
||||
ellipse(345, 50, 10, 10);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user