zoom in to checkerboard
@author
int LOOP = 300;
void setup(){
size(500, 500);
rectMode(CENTER);
}
void draw(){
background(255);
float time = frameCount % LOOP;
float centerX = map(time, 0, LOOP - 1, width * 7.0 / 8.0, width / 2.0);
float centerY = map(time, 0, LOOP - 1, height * 7.0 / 8.0, height / 2.0);
float rectSize = map(pow(time / (LOOP - 1), 7), 0, 1, 5, width);
int startX = int(centerX / rectSize) + 1;
int endX = int((width - centerX) / rectSize) + 1;
int startY = int(centerY / rectSize) + 1;
int endY = int((height - centerY) / rectSize) + 1;
noStroke();
fill(0);
for(int x = -startX; x <= endX; x++){
for(int y = -startY; y <= endY; y++){
if((x + y + 1000) % 2 == 1){
rect(centerX + x * rectSize, centerY + y * rectSize, rectSize, rectSize);
}
}
}
}