xxxxxxxxxx
63
let positions;
let border;
let notes = [];
function preload(){
border = loadImage("Border.png");
notes.push(loadSound('a3.mp3'));
notes.push(loadSound('b3.mp3'));
notes.push(loadSound('c3.mp3'));
notes.push(loadSound('d3.mp3'));
notes.push(loadSound('e3.mp3'));
notes.push(loadSound('f3.mp3'));
notes.push(loadSound('g3.mp3'));
}
function setup() {
createCanvas(800, 800);
}
function draw() {
background(20);
textAlign(CENTER,CENTER);
imageMode(CENTER);
fill(207, 41, 186);
stroke(220);
strokeWeight(4);
circle(mouseX,mouseY,420);
image(border,width/2,height/2,width,height);
textSize(500);
fill(20);
noStroke();
if (positions == 0){
text('A',width/2,height/2);
}
if (positions == 1){
text('B',width/2,height/2);
}
if (positions == 2){
text('C',width/2,height/2);
}
if (positions == 3){
text('D',width/2,height/2);
}
if (positions == 4){
text('E',width/2,height/2);
}
if (positions == 5){
text('F',width/2,height/2);
}
if (positions == 6){
text('G',width/2,height/2);
}
}
function keyPressed() {
if (key == "t") {
positions = int(random(7));
notes[positions].play();
}
}