Created
September 28, 2016 20:46
-
-
Save nataliefreed/0144e09a34b26584879928253b843877 to your computer and use it in GitHub Desktop.
Pick a random color from an array in P5
This file contains 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(600, 600); | |
var listOfColors = [color('#aabf12'), color('#33ab12'), color('#165512'), color('#fe3fa2'), color('#a345cd')]; | |
var stripeWidth = 20; | |
strokeWeight(stripeWidth); | |
for(var i=0;i<=width/stripeWidth;i++) { | |
stroke(listOfColors[int(random(0, listOfColors.length))]); | |
line(0, 0, 0, height); | |
translate(stripeWidth, 0); | |
} | |
} | |
function draw() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment