xxxxxxxxxx
30
// What is an Array?
// Code! Programming with p5.js
// The Coding Train / Daniel Shiffman
// https://thecodingtrain.com/beginners/p5js/7.1-what-is-an-array.html
// https://youtu.be/VIQoUghHSxU
// https://editor.p5js.org/codingtrain/sketches/DmwVbhOZ
var words = ["rainbow", "heart", "purple", "friendship", "love"];
let colors = ["red", "green", "pink", "blue", "yellow"];
var bump = 1;
function setup() {
createCanvas(400, 400);
}
function draw() {
background(0);
for (let i = 0; i < words.length; i++){
fill(colors[i]);
textSize((i * bump) + 16);
text(words[i], 12, i * 50 + 50);
}
}
function mousePressed() {
bump = bump + 10;
}