xxxxxxxxxx
74
var ball={};
var song;
var button;
var video;
function preload(){
soundFormats('mp3','ogg');
song = loadSound("Selva_Yuc.mp3");
}
function setup() {
createCanvas(400,400);
// button = createButton("JUNGLE");
//song = loadSound("Selva_Yuc.mp3", loaded);
//keyPressed();
// video = createCapture(VIDEO);
// video.hide();
}
function keyPressed(){
if (keyCode == UP_ARROW){
song.play();
} else{
song.stop();
}
}
// function togglePlaying() {
// if (!song.isPlaying()) {
// song.play();
// // button.html("STOP");
// } else {
// song.stop();
// // button.html("JUNGLE");
// }
// }
// function loaded() {
// console.log("loaded");
// }
//REPLACE WITH PIXELS
function mousePressed(){
var panning = map (ball.x,0.0,width, -1.0, 1.0);
song.pan(panning);
//song.play();
}
function draw (){
background(51);
ball.x = constrain(mouseX, 0, width);
ellipse(ball.x, height/2, 100,100);
// togglePlaying();
// var redestPixelX = 0;
// var redestPixelY = 0;
// var redestValue = 0;
// background(220);
// image(video,0,0,width,height);
// loadPixels();
// if (r > redestValue) {
// redestValue = r;
// redestPixelX = x;
// redestPixelY = y;
// }
//if (redestPixelX<width/2){
// updatePixels();
// ellipse(redestPixelX, redestPixelY, 20,20);
//panning code}
}