xxxxxxxxxx
38
let img;
let imgRatio = 1;
function preload() {
img = loadImage('badabing.png');
}
function setup() {
createCanvas(450, 800);
console.log(img.height, img.width)
imgRatio = img.height / img.width;
}
function draw() {
const c = color(250, 222, 215);
background(c);
if (frameCount < 600) {
translate(width/2, height/2);
rotate(frameCount/100);
for (let i = 0; i < 100; i++) {
rotate(10);
const r = map(frameCount/3, 0, 120, 10, 180, true);
const y = map(i, 0, 120, 2, constrain(frameCount, 0, 800), true);
image(img, 0, y, r, r * imgRatio);
}
if (frameCount > 450) {
const o = map(frameCount, 450, 600, 0, 255, true);
background(250, 222, 215, o);
}
} else {
const h = 300 * imgRatio;
image(img, width/2 - 150, 200, 300, h);
if (frameCount < 700) {
const o = map(frameCount, 600, 700, 255, 0, true);
background(250, 222, 215, o);
}
}
}