xxxxxxxxxx
69
/*
https://freesound.org/people/titi2/sounds/509937/
*/
var sounds
//var superman
var x = 200
var y = 200
function keyPressed(){
if(keyCode == 32){
if(sounds.isPlaying()){
sounds.pause();
} else{
sounds.play();
}
}
}
function setup() {
createCanvas(800, 800);
}
function preload() {
sounds = loadSound('birds.ogg');
//superman = loadSound("Superman.wav")
}
function draw() {
background('black');
var v = map(mouseY, 0, height, 1, 0);
sounds.setVolume(v);
var r = map(mouseX, 0, width, 0.1, 3, true);
//bird
fill("#03A9F4");
noStroke()
rect(x + 200, y + 350, x -90, 50, x - 190)
rect(x +90, y + 350, x -90, 50, x - 190)
ellipse(x + 200, y + 400, 100);
ellipse(x + 200, y + 330 , 50);
if (sounds.isPlaying()) {
fill("red");
triangle(x + 200, y + 490, x + 300, y + 350, x + 100 , y + 350);
//superman.play();
}
if (sounds.isPlaying()) {
y -= 5;
} else {
y = 200;
}
textSize(40);
textAlign(CENTER, CENTER);
text("Is it it a bird or a man?", width/2, height/2);
}
function mousePressed(){
save("birdman.png")
}