xxxxxxxxxx
47
let song;
function preload(){
song = loadSound("pa5.wav");
}
function setup() {
// Create Canvas
createCanvas(500, 500);
song.play();
}
let value = 0;
function draw() {
// Set background color
background(200);
// Fill the color
fill(value, value-50, value-100);
// Create rectangle
rect(25, 25, 460, 440);
// Set the color of text
fill('lightgreen');
// Set font size
textSize(15);
// Display content
text('Keep on Clicking the Mouse Across'
+ 'the page \nto change Canvas Color.',
windowHeight/10, windowWidth/4);
}
function mousePressed() {
value = value + 5;
if (value > 255) {
value = 0;
}
}