Created
April 19, 2016 15:13
-
-
Save nick3499/4e7681ec0115f5e0c38d668dd0ce91fb to your computer and use it in GitHub Desktop.
Quad. Using p5.js library.
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 setup() { | |
| createCanvas(720, 400); | |
| } | |
| function draw() { | |
| background(0, random(170, 255), random(170, 255)); | |
| noStroke(0); | |
| for (var i = 0; i < 20; i++) { | |
| // quad a | |
| var x1 = random(0, 360); | |
| var y1 = random(0, 200); | |
| var x2 = random(360, 720); | |
| var y2 = random(200, 400); | |
| var x3 = random(0, 360); | |
| var y3 = random(0, 200); | |
| var x4 = random(360, 720); | |
| var y4 = random(0, 200); | |
| // quad b | |
| var x5 = random(0, 360); | |
| var y5 = random(200, 400); | |
| var x6 = random(360, 720); | |
| var y6 = random(0, 200); | |
| var x7 = random(0, 360); | |
| var y7 = random(200, 400); | |
| var x8 = random(360, 720); | |
| var y8 = random(0, 200); | |
| fill(random(0, 85), random(85, 170), random(85, 170), random(20, 80)); | |
| quad(x1, y1, x2, y2, x3, y3, x4, y4); | |
| quad(x5, y5, x6, y6, x7, y7, x8, y8); | |
| } | |
| frameRate(1); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment