Patterns

Pattern 1 – Yellow boxes

1

float x=0;
float y=0;
void setup() {
size(600, 400);
}
void draw() {
background(255,232,150);

stroke(255);
strokeWeight(2);

x = 50;
while (x < width) {
line (x, 0, x, height);
x = x + 50;
}

y = 50;
while (y < height) {
line (0, y, width, y);
y = y + 50;
}
}

Pattern 2 – Dots

2
void setup() {
size(700, 700);
}

void draw() {
background(115,191,188);
noStroke();
fill(35,35,35);

for (int y = 50; y <=600; y += 50){
for (int x = 50; x <=600; x += 50){
ellipse(x, y, 30, 30);
}
}
}

Pattern 3 – Small sticks

3

void setup() {
size(600, 600);
smooth();
noFill();
}
void draw() {
background(255, 229, 240);

stroke(255);
strokeWeight(2);

for (int x = 50; x <= width – 50; x += 20) {
for (int y = 50; y <= height – 50; y += 20) {
line (x+3, y+7, x+15, y+10);
line (x-5, y-9, x-5, y-3);
}
}
}

Pattern 4 – Shapes

4

void setup() {
size(600, 600);
smooth();
noFill();
}
void draw() {
background(255, 229, 240);

noStroke();

for (int x = 50; x <= width – 50; x += 30) {
for (int y = 50; y <= height – 50; y += 30) {
float s = map (count, 120, 0, 0, TWO_PI*2);
fill(234, 18, 110);
arc (x, y, 25, 25, s, PI+QUARTER_PI, OPEN);
}
for (int y = 50; y <= height – 50; y +=30) {
fill(0,0,0);
rect (x, y, 10, 15);
}
}
}

Pattern 5 – Interactive pattern

5-1

5-2

int value = 0;

void setup() {
size(700, 700);
}

void draw() {
background(211, 255, 255);
noStroke();
fill(value);

for (int y = 50; y <=600; y += 50){
for (int x = 50; x <=600; x += 50){
ellipse(x, y, 30, 30);
}
}
}

void mouseMoved() {
value = value + 1;
if (value > 255) {
value = 0;
}
}

 

Heewon Kim

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s