Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
who's your baby
let fruit1, fruit2, fruit3, fruit4, fruit5, fruit6;
let vid1, vid2, vid3, vid4, vid5, vid6;
function preload() {
fruit1 = loadSound('onepercent.wav');
fruit2 = loadSound('hypergendered.wav');
fruit3 = loadSound('void.wav');
fruit4 = loadSound('caterpillar.wav');
fruit5 = loadSound('waterbirth.wav');
fruit6 = loadSound('commune.wav');
}
function setup() {
createCanvas(windowWidth, windowHeight);
vid1=createVideo('fruit1.mp4',vidLoad);
vid1.hide();
vid2=createVideo('fruit2.mp4',vidLoad);
vid2.hide();
vid3=createVideo('fruit3.mp4',vidLoad);
vid3.hide();
vid4=createVideo('fruit4.mp4',vidLoad);
vid4.hide();
vid5=createVideo('fruit5.mp4',vidLoad);
vid5.hide();
vid6=createVideo('fruit6.mp4',vidLoad);
vid6.hide();
}
function vidLoad() {
vid1.play();
vid1.loop();
vid2.play();
vid2.loop();
vid3.play();
vid3.loop();
vid4.play();
vid4.loop();
vid5.play();
vid5.loop();
vid6.play();
vid6.loop();
}
function draw() {
background(0);
image(vid1,0,0,windowWidth/3,windowHeight/2);
image(vid2,windowWidth/3,0,windowWidth/3,windowHeight/2);
image(vid3,2*windowWidth/3,0,windowWidth/3,windowHeight/2);
image(vid4,0,windowHeight/2,windowWidth/3,windowHeight/2);
image(vid5,windowWidth/3,windowHeight/2,windowWidth/3,windowHeight/2);
image(vid6,2*windowWidth/3,windowHeight/2,windowWidth/3,windowHeight/2);
}
function mousePressed() {
if (mouseX > 0 && mouseX < windowWidth/3 && mouseY > 0 && mouseY <windowHeight/2) {
fruit1.play();
} else if (mouseX > windowWidth/3 && mouseX < 2*windowWidth/3 && mouseY > 0 && mouseY <windowHeight/2 ) {
fruit2.play();
} else if (mouseX > 2*windowWidth/3 && mouseX < windowWidth && mouseY > 0 && mouseY <windowHeight/2) {
fruit3.play();
} else if (mouseX > 0 && mouseX < windowWidth/3 && mouseY > windowHeight/2 && mouseY < windowHeight) {
fruit4.play();
} else if (mouseX > windowWidth/3 && mouseX < 2*windowWidth/3 && mouseY > windowHeight/2 && mouseY < windowHeight) {
fruit5.play();
} else if (mouseX > 2*windowWidth/3 && mouseX < windowWidth && mouseY > windowHeight/2 && mouseY < windowHeight) {
fruit6.play();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.