xxxxxxxxxx
22
let song;
function setup() {
createCanvas(400, 400);
song = loadSound('bensound-jazzyfrenchy.mp3');
}
function draw() {
background(220);
var hotdog = createButton('');
hotdog.position(55,40);
hotdog.mousePressed(toggleSound);
//hotdog.addClass('eyeball');
}
function toggleSound(){
if (song.isPlaying()){
song.stop();
}else{
song.play();
}
}