xxxxxxxxxx
41
let img;
const hw = 400;
function preload() {
img = loadImage('https://i.ibb.co/LdnQNgY/Cat.png')
}
function setup() {
createCanvas(hw*2, hw);
}
function draw() {
background(200, 100, 255)
const s = map(sin(millis() * 0.001), -1, 1, 1, 5);
// right side
push()
translate(hw, 0)
translate(hw/2, hw/2)
scale(s, s)
translate(-mouseX, -mouseY)
image(img, 0, 0, hw, hw)
pop()
// left side
fill(255, 100, 100)
noStroke()
rect(0, 0, hw, hw)
image(img, 0, 0, hw, hw)
push()
stroke(0)
noFill()
translate(mouseX, mouseY)
scale(1/s, 1/s)
translate(-hw/2, -hw/2)
rect(0, 0, hw, hw)
pop()
}