xxxxxxxxxx
45
let crv
let zx=0
let zy=0
let pts = []
let m = 1.005
let mstart = m
function preload() {
crv = loadImage('download.png')
}
document.onscroll = function() {
zx++
zy++
m*=mstart
}
function setup() {
createCanvas(600, 300);
pts.push(createVector(-900, -height/2-30))
pts.push(createVector(-10, -height/2))
pts.push(createVector(10, height/2))
pts.push(createVector(900, height/2+30))
}
function draw() {
background(220);
line(width/2, 0, width/2, height)
push()
translate(width/4, height/2)
noFill()
curve(pts[0].x*m, pts[0].y*m,
pts[1].x*m, pts[1].y*m,
pts[2].x*m, pts[2].y*m,
pts[3].x*m, pts[3].y*m)
pop()
push()
translate(width/2,0)
image(crv, 0,0,width/2, height, 0+zx,0+zy, width-2*zx, width-2*zy)
pop()
}