xxxxxxxxxx
81
/*
meme. part 3 animation
*/
var spiderImage;
var whatImage;
var fryImage;
var emojiImage;
var counter = 0;
var x = -150;
var y = 0;
var w = 1500;
var h = 1000;
var a = -300;
function preload() {
spiderImage = loadImage("Spider.jpeg");
whatImage = loadImage("what.jpeg");
fryImage = loadImage("fry.jpeg");
emojiImage = loadImage("emoji2.png");
}
function mousePressed() {
counter++; //counter = counter = 1
if (counter > 2) {
counter = 0;
}
}
function setup() {
createCanvas(750, 450);
}
function draw() {
background(220);
if (x == -150) {
image(spiderImage, x, y, w, h);
textSize(25);
stroke("blue");
strokeWeight(3);
text("ME", 200, 180, 150, 100);
}
w += 1;
h += 2;
if (w > 1900 && h > 1400) {
x = -750;
w = 1500;
h = 1000;
} else if (x == -750) {
image(spiderImage, x, y, w, h);
textSize(27);
stroke("blue");
text("the person who wastes my salary", 300, 200, 150, 100);
}
if (counter == 1) {
tint(255, 0, 100);
image(whatImage, 0, 0, width, 600);
textSize(30);
text("ME???", 350, 200);
} else if (counter == 2) {
tint(255);
image(fryImage, 0, 0);
image(emojiImage, a, 330, 200, 100);
a += 5;
if (a > width) {
a = -300;
}
textSize(30);
text("I knew it!", 350, 200);
} else {
noTint();
}
text(counter, 30, 50)
}