ProcessingClass_09_Function_函數(副程式)
Class Room in OpenProcessing
Function 函數(副程式)
void setup() { size(400, 400); background(255); rectMode(CENTER); ellipseMode(CENTER); smooth(); frameRate(5); } void draw() { for (int i = 0; i < 400; i += 20) { for (int j = 0; j < 400; j += 20) { rect_circle(i+10, j+10); } } } void rect_circle (float x, float y) { fill(0); rect(x, y, 20, 20); fill(255); ellipse(x, y, 20, 20); }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); rectMode(CENTER); ellipseMode(CENTER); smooth(); frameRate(5); } void draw() { rect_circle(random(width),random(height)); } void rect_circle (float x, float y) { fill(0); rect(x,y,100,100); fill(255); ellipse(x,y,100,100); }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); rectMode(CENTER); ellipseMode(CENTER); smooth(); frameRate(5); } void draw() { rect_circle(random(width),random(height)); } void rect_circle (float x, float y) { float w = random(60); fill(0); rect(x,y,w,w); fill(255); ellipse(x,y,w,w); }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); rectMode(CENTER); ellipseMode(CENTER); smooth(); frameRate(5); } void draw() { rect_circle(random(width),random(height)); } void rect_circle (float x, float y) { float w = random(60); fill(random(255),random(255),random(255)); rect(x,y,w,w); fill(255); ellipse(x,y,w,w); }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); rectMode(CENTER); ellipseMode(CENTER); smooth(); frameRate(5); } void draw() { rect_circle(random(2)); } void rect_circle (float z) { if (z > 1) {rect_circle_1(random(width), random(height));} else {rect_circle_2(random(width), random(height));} } void rect_circle_1 (float x, float y) { float w = random(60); fill(random(255),random(255),random(255)); rect(x,y,w,w); fill(255); ellipse(x,y,w,w); } void rect_circle_2 (float x, float y) { float w = random(60); fill(255); rect(x,y,w,w); fill(random(255),random(255),random(255)); ellipse(x,y,w,w); }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); rectMode(CENTER); } void draw() { five_rects(random(width),random(height)); } void five_rects (float x, float y) { for (int i = 0; i < 5; i += 1) { if ((i % 2) == 1) {fill(255);} else {fill(0);} rect(x,y,100-20*i,100-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); //rectMode(CENTER); } void draw() { five_rects(random(width),random(height)); } void five_rects (float x, float y) { for (int i = 0; i < 5; i += 1) { if ((i % 2) == 1) {fill(255);} else {fill(0);} rect(x,y,100-20*i,100-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); smooth(); frameRate(5); } void draw() { circles(random(width),random(height)); } void circles (float x, float y) { for (int i = 0; i < 5; i += 1) { if ((i % 2) == 1) {fill(255);} else {fill(0);} ellipse(x,y,100-20*i,100-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); smooth(); frameRate(5); } void draw() { circles(random(width),random(height)); } void circles (float x, float y) { for (int i = 0; i < 5; i += 1) { fill(random(255),random(255),random(255)); ellipse(x,y,100-20*i,100-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); smooth(); frameRate(5); } void draw() { int i; circles(random(width),random(height), int(random(1,5))); } void circles (float x, float y, int step) { for (int i = 0; i < step; i += 1) { fill(random(255),random(255),random(255)); ellipse(x,y,100-20*i,100-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); smooth(); frameRate(5); } void draw() { int i; circles(random(width),random(height), int(random(1,10)),int(random(100,200))); } void circles (float x, float y, int step, int d) { for (int i = 0; i < step; i += 1) { fill(random(255),random(255),random(255)); ellipse(x,y,d-20*i,d-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); smooth(); frameRate(5); } void draw() { int i; circles(random(width),random(height), int(random(1,10)),int(random(100,200))); } void circles (float x, float y, int step, int d) { for (int i = 0; i < step; i += 1) { fill(random(255),random(255),random(255),125); ellipse(x,y,d-20*i,d-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); smooth(); noStroke(); } void draw() { int i; frameRate(5); circles(random(width),random(height), int(random(1,10)),int(random(100,200))); } void circles (float x, float y, int step, int d) { for (int i = 0; i < step; i += 1) { fill(random(255),random(255),random(255),150); ellipse(x,y,d-20*i,d-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); smooth(); noStroke(); frameRate(5); } void draw() { int i; many_rects(random(width),random(height), int(random(1,10)),int(random(100,200))); } void many_rects (float x, float y, int step, int d) { for (int i = 0; i < step; i += 1) { fill(random(255),random(255),random(255),255); rect(x,y,d-20*i,d-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); smooth(); noStroke(); rectMode(CENTER); frameRate(5); } void draw() { int i; many_rects(random(width),random(height), int(random(1,10)),int(random(100,200))); } void many_rects (float x, float y, int step, int d) { for (int i = 0; i < step; i += 1) { fill(random(255),random(255),random(255),255); rect(x,y,d-20*i,d-20*i); } }
==============================================================================
Interactive Link
void setup() { size(400,400); background(255); smooth(); noStroke(); rectMode(CENTER); frameRate(5); } void draw() { int i; many_rects(random(width),random(height), int(random(1,10)),int(random(100,200))); } void many_rects (float x, float y, int step, int d) { for (int i = 0; i < step; i += 1) { fill(random(255),random(255),random(255), random(255)); rect(x,y,d-20*i,d-20*i); } }
==============================================================================