I'm having trouble figuring out after how many frames the animation completes in order to create a perfect loop. I'm currently recording my canvas in 60 fps. Any ideas?
for (x = 0; x < pg.width; x += 2) {
for (y = 0; y < pg.height; y += 2) {
let csize = map(sin(x+y+frameCount/10), -1, 1, 2, 20);
if (a[x][y] > 0) {
rect(x*2-csize/2, y*2-csize/2, csize);
}
}
}
You should check for when sin(x+y+0/10) equals sin(x+y+frameCount/10) since I'm assuming that's the only place where you use frameCount.