Forked from nataliefreed/randomColorFromArray.js
Last active
February 26, 2018 20:43
-
-
Save lizzybrooks/8cccb105a745af23f9494311057f3034 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(700, 400); | |
var listOfColors = [color('#aabf12'), color('#33ab12'), color('#165512'), color('#fe3fa2'), color('#a345cd')]; | |
strokeWeight(100); | |
for(var i=0;i<listOfColors.length;i++) { | |
stroke(listOfColors[i]); | |
// stroke(listOfColors[int(random(0, listOfColors.length))]); //to randomize, comment this line in | |
line(0, 0, 0, height); | |
translate(100, 0); | |
} | |
} | |
function draw() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment