All examples · Sprites and 2D · As Markdown, for AIs

Pixel snap camera

What this example shows

A camera moved by hand a fraction of a pixel a frame, over stripes one pixel wide, at zoom 3. With pixelSnap the scene's camera is drawn on whole pixels like everything else, so the stripes stay the same width: on the screen's pixels ('screen', the default for pixel art) they slide one screen pixel at a time, on the game's ('game') three at once, as the consoles drew.

Where the camera is keeps its fractions, so it moves exactly as fast as it says, and the pointer reads the world through the camera as it is drawn. Press P to go through the modes (useGame().setPixelSnap, with RENDER.PIXEL_SNAP) and, with 'off', see the stripes flicker: now and then, as the camera lands half a pixel between two, they come out two and four pixels wide. The arrows change the speed and Space stops it.

Starting
Starting
—