animatedSquare = {
const { canvas, context } = createCanvas();
const { width, height, pixelRatio } = resize(canvas);
function render (time = 0) {
window.requestAnimationFrame(render);
time /= 1000;
context.save();
context.scale(pixelRatio, pixelRatio);
context.fillStyle = 'rgba(0,33)';
context.fillRect(0, 0, width, height);
for(let i=0; i<20; i+=2){
const x = width / 2 + Math.sin(time*3+i) * width / 4;
const y = height / 2 + Math.cos(time*1.5+i) * height / 4;
context.fillStyle = 'rgb(0,0,255)';
let s = Math.sin(time*2.5+i) * 50;
context.fillRect(x, y, s, s);
}
context.restore();
}
window.requestAnimationFrame(render);
return canvas;
}