Drawing Pixel Creatures with Crisp SVG Rectangles
Why shape-rendering="crispEdges" and steps(1) keyframes give inline SVGs authentic pixel-art energy.
On this page (2)
Most vector illustrations try to smooth away the grid. Klaudia goes in the opposite direction: every stripe of her body is aligned to a clean 15-unit pixel grid inside a 480×320 viewBox, with shape-rendering="crispEdges" keeping every corner razor sharp at any DPI.
Why steps(1) feels alive #
Smooth CSS easing (ease-in-out) makes pixel art look like a sticker sliding on glass. Switching the bob animation to steps(1) snaps Klaudia cleanly between two frames:
.sprite {
width: 13.5rem;
max-width: 72vw;
height: auto;
animation: bob 1.6s steps(1) infinite;
}
.eye {
transform-box: fill-box;
transform-origin: center;
animation: blink 5s infinite;
}
@keyframes bob {
50% { transform: translateY(-6px); }
}Respecting motion preferences #
Animations are fun until they cause discomfort. Wrapping all sprite motion in @media (prefers-reduced-motion: reduce) ensures Klaudia rests calmly whenever a reader prefers reduced motion.
| Property | Purpose | Fallback |
|---|---|---|
shape-rendering="crispEdges" | Disable anti-aliasing on pixel rects | Crisp pixel edges |
transform-box: fill-box | Anchor eye blink to each rect | Center origin |
steps(1) | Discrete 2-frame idle bounce | Disabled when reduced |