xxxxxxxxxx
86
//Maria Hernandez meme
//when clicking on the image, the image will rotate faster. prepare for your eyes to be in pain.
var chiwawaImage, chiwawaOriginal;
var w, h;
var r = 0;
var imageScale = 1;
var scaleSpeed = 0.02;
// image copyright of author
function preload() {
chiwawaImage = loadImage("Chiquita.jpg");
chiwawaOriginal = loadImage("Chiquita.jpg");
}
function mousePressed() {
chiwawaImage.copy(chiwawaOriginal, 0, 0, w, h, 0, 0, w, h);
}
function setup() {
createCanvas(600, 600);
textFont("Helvetica", 26);
imageMode(CENTER);
textAlign(CENTER, CENTER);
w = chiwawaImage.width;
h = chiwawaImage.height;
}
function draw() {
background(0);
translate(width / 2, height / 2);
push();
scale(imageScale);
imageScale += scaleSpeed;
if (imageScale > 2 || imageScale < 0) {
scaleSpeed *= -1;
}
image(chiwawaOriginal,chiwawaImage, 0, 0);
rotate(r);
shearY(r / 4);
r += 0.05;
// random position in the image of pixels
let x1 = floor(random(chiwawaImage.width));
let y1 = floor(random(chiwawaImage.height));
let x2 = floor(random(chiwawaImage.width));
let y2 = floor(random(chiwawaImage.height));
let x3 = floor(random(chiwawaImage.width));
let y3 = floor(random(chiwawaImage.height));
// pixel color black
let black = color(0);
chiwawaImage.loadPixels();
chiwawaImage.set(x1, y1, black);
chiwawaImage.set(x2, y2, black);
chiwawaImage.set(x3, y3, black);
chiwawaImage.updatePixels();
image(chiwawaImage, 140, -60, 330, 470);
fill("white");
stroke("red");
strokeWeight("4");
text("When your owner", 160, -250);
text("is petting a dog,",160,100)
text("too much for ur liking",160, 140)
}