Skip to content

Instantly share code, notes, and snippets.

@nataliefreed
Created September 28, 2016 20:46
Show Gist options
  • Save nataliefreed/0144e09a34b26584879928253b843877 to your computer and use it in GitHub Desktop.
Save nataliefreed/0144e09a34b26584879928253b843877 to your computer and use it in GitHub Desktop.
Pick a random color from an array in P5
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