This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // "number in box" - try clicking in the window | |
| // this is the "data" | |
| var c = 0; | |
| var x = 50; | |
| var y = 50; | |
| function setup() { | |
| createCanvas(340, 340); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rect(50, 50, 200, 200); | |
| rect(50+10, 50+10, 200, 200); | |
| rect(50+20, 50+20, 200, 200); | |
| rect(50, 50, 200, 200); | |
| rect(60, 60, 200, 200); | |
| rect(70, 70, 200, 200); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rect(70, 70, 200, 200); | |
| rect(width/2 - 100, height/2 - 100, 200, 200); | |
| var offset = 100; | |
| rect(width/2 - offset, height/2 - offset, offset*2, offset*2); | |
| offset = 90; | |
| rect(width/2 - offset, height/2 - offset, offset*2, offset*2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for (var x = 10; x < width; x += 20) { | |
| line(x, 10, x, height-10); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for (var x = 10; x < width; x += 20) { | |
| if (x < width/2) { | |
| line(x, 10, x, height/2); | |
| } else { | |
| line(x, height-10, x, height/2); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function happyFace(x, y) { | |
| // head | |
| ellipse(x, y, 100, 100); | |
| // eyes | |
| ellipse(x-20, y-25, 20, 20); | |
| ellipse(x+20, y-25, 20, 20); | |
| // nose | |
| line(x, y-20, x-10, y); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // "spaced colored squares" -- object edition | |
| colorMode(HSB); | |
| noFill(); | |
| var SIZE = 40; | |
| var squares = []; | |
| for (var x = 50; x <= 250; x = x + 50) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // "spaced colored squares" -- array edition | |
| colorMode(HSB); | |
| noFill(); | |
| var SIZE = 40; | |
| var xs = [50, 100, 150, 200, 250]; | |
| var y = height/2 - SIZE/2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // "spaced colored squares" -- array edition | |
| colorMode(HSB); | |
| noFill(); | |
| var SIZE = 40; | |
| var y = height/2 - SIZE/2; | |
| var squares = [ | |
| { x: 50, y: y }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // "spaced colored squares" -- object edition | |
| var squares = []; | |
| function setup() { | |
| colorMode(HSB); | |
| noFill(); | |
| for (var x = 50; x <= 250; x = x + 50) { | |
| squares.push({ |