xxxxxxxxxx
64
let sound, takerimba;
var shape = {
x : 200,
y : 200,
display : function() {
ellipse(this.x, this.y, 100, 100)
}
}
function preload(){
bubble1 = loadSound('sounds/bubble1.wav');
blip = loadSound('sounds/blip.wav');
}
function setup() {
createCanvas(400, 400);
slider = createSlider(0,1,0.2,0.01);
}
function draw() {
background(220);
noStroke();
blip.setVolume(slider.value());
push();
// rectMode(CENTER);
translate(width/2,height/2);
let bubble1angle = map(bubble1.currentTime(), 0, bubble1.duration(), 0, PI);
rotate(-bubble1angle);
let blipangle = map(blip.currentTime(), 0, blip.duration(), 0, PI);
rotate(blipangle);
rect(0, 0, 100, 100);
rect(-100, -100, 100, 100);
pop();
}
function keyPressed(){
if (keyCode === 65) {
fill(0);
shape.display();
bubble1.play();
} else if (keyCode === 83) {
fill(5,125,73);
shape.display();
blip.play();
}
}
function shape(){
// push();
// rectMode(CENTER);
// translate(width/2,height/2);
// let bubble1angle = map(bubble1.currentTime(), 0, bubble1.duration(), 0, TWO_PI);
// rotate(-bubble1angle);
// let blipangle = map(blip.currentTime(), 0, blip.duration(), 0, PI);
// rotate(blipangle);
// rect(0, 0, 100,100);
// pop();
}