key press to switch sound o and off : (s)= on, (j)= off mouse press to switch between photos
xxxxxxxxxx
//-----------------------------------------------------------------
//GLOBAL VARIABLE FUNCTIONS--------------------------------------
let p;
let h;
let o;
let t;
let oo;
let imageList = [];
let imageNumber = 0;
let textList = [];
//-------------------------------------------------------------
// PRELOAD-----------------------------------------------------
function preload(){
p = loadImage ("p.JPG");
h = loadImage ("h.JPG");
o = loadImage ("o.JPG");
t = loadImage ("t.JPG");
oo = loadImage ("oo.JPG");
song = loadSound("bigsean.mp3");
}
//--------------------------------------------------------------
//MAIN FUNCTIONS------------------------------------------------
function setup() {
createCanvas(800, 800);
//IMAGE ARRAY
imageList = [p,h,o,t,oo];
widthList = [600,600,600,600,600];
heightList = [750,750,750,750,750];
textList = ["August 20th, 2019, the day that would change the lives of those in the AUC.", "One girl would sit on the rocky side, holding her chest as blood poured from a single wound.","Camus police would take so long to come, making her question the state of reality she was thrown into.", "People from all over would stare, watch, and cry, as this young girl went into a state of peril.", "Reality would change forever, changing the young girl and how she viewed the world." ];
imageNumber = 0;
//MODES
imageMode(CENTER);
}
function draw() {
background(40);
image(imageList[imageNumber],400,400, widthList[imageNumber], heightList[imageNumber]);
//text(textList[imageNumber], 200,350);
text(textList[imageNumber],200,200,200,350);
fill(255,255,255);
}
//--------------------------------------------------------------
//INTERACTIVE FUNCTIONS-----------------------------------------
function keyPressed(){
if(key === 's'){
//play sound
song.play();
}
if (key === 'j'){
//stop sound
song.stop();
}
}
function mousePressed(){
imageNumber++;
if(imageNumber > 4){
imageNumber = 0;
}
}