nick34992
4/19/2016 - 3:59 PM

Text Array. Using p5.js library.

Text Array. Using p5.js library.

// featured in one of Shiffman's video tutorials
var words = ["frisbee","skateboard","softball","slingshot","love"];
var index = 0;

function setup () {
  createCanvas(400,400);
}

function draw () {
  background(0);
  frameRate(1);
  fill(random(255));
  textSize(72);
  text(words[index],12,200);
}

function mousePressed() {
  index = index + 1;
  if (index==words.length) {
    index=0;
  }
}