mirror of
https://github.com/processing/processing4.git
synced 2026-02-03 05:39:18 +01:00
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
// Example 04-01 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
int y = 60;
|
||||
int d = 80;
|
||||
ellipse(75, y, d, d); // Left
|
||||
ellipse(175, y, d, d); // Middle
|
||||
ellipse(275, y, d, d); // Right
|
||||
@@ -0,0 +1,10 @@
|
||||
// Example 04-02 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
int y = 100;
|
||||
int d = 130;
|
||||
ellipse(75, y, d, d); // Left
|
||||
ellipse(175, y, d, d); // Middle
|
||||
ellipse(275, y, d, d); // Right
|
||||
@@ -0,0 +1,8 @@
|
||||
// Example 04-03 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
line(0, 0, width, height); // Line from (0,0) to (480, 120)
|
||||
line(width, 0, 0, height); // Line from (480, 0) to (0, 120)
|
||||
ellipse(width/2, height/2, 60, 60);
|
||||
@@ -0,0 +1,12 @@
|
||||
// Example 04-04 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
int x = 25;
|
||||
int h = 20;
|
||||
int y = 25;
|
||||
rect(x, y, 300, h); // Top
|
||||
x = x + 100;
|
||||
rect(x, y + h, 300, h); // Middle
|
||||
x = x - 250;
|
||||
rect(x, y + h*2, 300, h); // Bottom
|
||||
@@ -0,0 +1,13 @@
|
||||
// Example 04-05 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
strokeWeight(8);
|
||||
line(20, 40, 80, 80);
|
||||
line(80, 40, 140, 80);
|
||||
line(140, 40, 200, 80);
|
||||
line(200, 40, 260, 80);
|
||||
line(260, 40, 320, 80);
|
||||
line(320, 40, 380, 80);
|
||||
line(380, 40, 440, 80);
|
||||
@@ -0,0 +1,10 @@
|
||||
// Example 04-06 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
strokeWeight(8);
|
||||
for (int i = 20; i < 400; i += 60) {
|
||||
line(i, 40, i + 60, 80);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// Example 04-07 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
strokeWeight(2);
|
||||
for (int i = 20; i < 400; i += 8) {
|
||||
line(i, 40, i + 60, 80);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// Example 04-08 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
strokeWeight(2);
|
||||
for (int i = 20; i < 400; i += 20) {
|
||||
line(i, 0, i + i/2, 80);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// Example 04-09 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
smooth();
|
||||
strokeWeight(2);
|
||||
for (int i = 20; i < 400; i += 20) {
|
||||
line(i, 0, i + i/2, 80);
|
||||
line(i + i/2, 80, i*1.2, 120);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Example 04-10 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
background(0);
|
||||
smooth();
|
||||
noStroke();
|
||||
for (int y = 0; y <= height; y += 40) {
|
||||
for (int x = 0; x <= width; x += 40) {
|
||||
fill(255, 140);
|
||||
ellipse(x, y, 40, 40);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Example 04-11 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
background(0);
|
||||
smooth();
|
||||
noStroke();
|
||||
for (int y = 0; y < height+45; y += 40) {
|
||||
fill(255, 140);
|
||||
ellipse(0, y, 40, 40);
|
||||
}
|
||||
for (int x = 0; x < width+45; x += 40) {
|
||||
fill(255, 140);
|
||||
ellipse(x, 0, 40, 40);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
// Example 04-12 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
background(0);
|
||||
smooth();
|
||||
fill(255);
|
||||
stroke(102);
|
||||
for (int y = 20; y <= height-20; y += 10) {
|
||||
for (int x = 20; x <= width-20; x += 10) {
|
||||
ellipse(x, y, 4, 4);
|
||||
// Draw a line to the center of the display
|
||||
line(x, y, 240, 60);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
// Example 04-13 from "Getting Started with Processing"
|
||||
// by Reas & Fry. O'Reilly / Make 2010
|
||||
|
||||
size(480, 120);
|
||||
background(0);
|
||||
smooth();
|
||||
for (int y = 32; y <= height; y += 8) {
|
||||
for (int x = 12; x <= width; x += 15) {
|
||||
ellipse(x + y, y, 16 - y/10.0, 16 - y/10.0);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user