to play music press 'm' to stop music press 'n' to cycle through picture use mouse!
xxxxxxxxxx
//global variable space
//image and song var
let janiceandsophia;
let janice;
let caroline;
let carolinesenior;
let greatgma;
let song;
let imageNumber=0;
//Arrays
let imageList= [];
//-----------------------------------------
//preload functions
function preload(){
// Song
//msoundFormats('mp3')
//Load Media
greatgma=loadImage('great gma.jpeg')
janiceandsophia=loadImage('Janice and Sophia.jpeg')
janice=loadImage('Janice.jpeg')
caroline=loadImage('caroline baby picture.jpeg')
carolinesenior=loadImage('caroline senior picture.jpeg')
song=loadSound('song.mp3');
}
//-----------------------------------------
//Main Functions
function setup() {
createCanvas(400, 400);
//Image Array
imageList=[greatgma,janiceandsophia,janice,caroline,carolinesenior];
widthList=
heightList=
imageNumber=0;
// MODES
angleMode(DEGREES);
rectMode(CENTER);
imageMode(CENTER);
//variable
list= [color(135, 107, 54), color(13, 13, 12), color(135, 107, 54)];
}
function draw() {
background(random(list));
frameRate(1)
image(imageList[imageNumber],200,200,200,400);
//draw image
//image(greatgma,200,200,230,400);
//image(janice,200,200,200,200);
//image(jandS,200,200,200,200);
//image(caroline,200,200,200,200);
//image(carolinesenior,200,200,200,200);
}
//-----------------------------------------
//interactive functions
function keyPressed(){
if(key==='m'){
//play sound
song.play();
}
if (key==='n'){
//stop sound
song.stop()
}
}
function mousePressed(){
imageNumber++;
if(imageNumber>4){
imageNumber=0;
}
}