xxxxxxxxxx
72
let audioEl;
function preload() {
soundFormats('mp3', 'ogg');
audioEl = loadSound('data/hey');
}
// If the mouse is pressed,
// toggle full-screen mode.
function mousePressed() {
if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {
let fs = fullscreen();
fullscreen(!fs);
}
}
function setup() {
audioEl.play();
let cnv = createCanvas(1920, 1080);
cnv.mousePressed(canvasPressed);
background(20);
text('tap here to play', 10, 20);
// schedule three calls to changeBackground
//audioEl.addCue(0.3, changeBackground, color(255, 0, 0)); //red
//audioEl.addCue(1.0, changeBackground, color(0, 255, 0));
//audioEl.addCue(32, changeBackground, color(0, 0, 255));
//audioEl.addCue(3.0, changeBackground, color(0, 255, 255));
//audioEl.addCue(4.2, changeBackground, color(255, 255, 0));
//audioEl.addCue(5.0, changeBackground, color(255, 255, 0));
//audioEl.addCue(5.5, changeBackground, color(223, 0, 0));
//audioEl.addCue(6.0, changeBackground, color(0, 255, 0);
//audioEl.addCue(6.5, changeBackground, color(0, 0, 255));
//audioEl.addCue(7.0, changeBackground, color(0, 255, 255));
//audioEl.addCue(8.2, changeBackground, color(255, 255, 0));
//audioEl.addCue(9.0, changeBackground, color(255, 255, 0));
//audioEl.addCue(9.0, changeBackground, color(255, 255, 0));//yellow
//audioEl.addCue(90, changeBackground, color(0, 0, 0));//black
//audioEl.addCue(10, time, 45);
//audioEl.addCue(11, time, 55);
//audioEl.addCue(12, time, 10);
//audioEl.addCue(13, time, 2);
//audioEl.addCue(1, tri, 200);
//audioEl.addCue(38.0, rectan, 20);
//audioEl.addCue(0, tri, 200);
//audioEl.addCue(35, tri, 200);
//audioEl.addCue(89, tri, 200);
//audioEl.addCue(3.2, array, 8)
//audioEl.addCue(145, array, 8); //2'25
//audioEl.addCue(147, changeBackground, color(0, 0, 0));//black
//audioEl.addCue(152, array, 8); //2'33
//audioEl.addCue(156, changeBackground, color(0, 0, 0));//black
//audioEl.addCue(168, array, 8); //2'48
//audioEl.addCue(171, changeBackground, color(0, 0, 0));//black
//audioEl.addCue(176, array, 8); //2'56 crystals falling away to a rising surge
//audioEl.addCue(100, changeBackground, color(255, 255, 0));//yellow
}
function draw()
{
}
function canvasPressed() {
audioEl.play();
}