8x8x8x8 supports multiple URL encoding formats, automatically selecting the most efficient one for each animation.
| Format | Description | Best For | Prefix |
|---|---|---|---|
| Legacy | Uncompressed 560-char hex | Backward compatibility | none |
| v2 | Gzip-compressed hex | General purpose baseline | v2: |
| v3 | Gzip-compressed delta encoding | Similar consecutive frames | v3: |
| v4 | Gzip-compressed run-length encoding | Solid colors, gradients | v4: |
- Length: Always 560 characters
- Format:
[palette:48][frames:512] - Use case: Backward compatibility with pre-compression versions
- Example:
ff0000...(direct hex, no prefix)
- Format:
v2:[base64-gzip-compressed-hex] - Encoding: Palette + all frames as hex → gzip → base64url
- Best for: Random or highly varied animations
- Format:
v3:[base64-gzip-compressed-delta] - Encoding:
- Store first frame completely (64 hex chars)
- For frames 2-8: store only changed pixels
- Each delta:
[count:2hex][position:3hex,color:3hex...] - Position and color packed as 9-bit value (position<<3 | color)
- Best for: Smooth animations with gradual changes, static images, looping animations
- Format:
v4:[base64-gzip-compressed-rle] - Encoding:
- Each frame encoded as runs of consecutive pixels
- Each run:
[count:2hex][color:3hex,length:3hex...] - Color and run length packed as 9-bit value (color<<6 | (length-1))
- Maximum run length: 63 pixels
- Best for: Solid color fills, gradients, simple geometric shapes
The encoder automatically:
- Encodes the animation in all three formats (v2, v3, v4)
- Compares uncompressed lengths
- Compresses the shortest with gzip
- Updates URL with the winning format
Example console output:
Encoding: v3, uncompressed: 234 chars, compressed: 89 chars
Typical compression ratios (original 560 chars):
| Animation Type | Best Format | Typical Size | Reduction |
|---|---|---|---|
| Empty (all black) | v3 + gzip | ~60 chars | 89% |
| Solid color per frame | v4 + gzip | ~70 chars | 87% |
| Gradual animation | v3 + gzip | ~120 chars | 79% |
| Checkerboard pattern | v2 + gzip | ~180 chars | 68% |
| Random noise | v2 + gzip | ~200 chars | 64% |
V3 Delta Encoding (9 bits per change):
[6 bits: pixel position (0-63)][3 bits: color index (0-7)]
V4 Run-Length Encoding (9 bits per run):
[3 bits: color index (0-7)][6 bits: run length - 1 (0-62)]
All compressed data uses URL-safe base64:
- Replace
+with- - Replace
/with_ - Remove padding
=
The decoder automatically detects and handles:
- Legacy 560-char uncompressed format
- v2, v3, v4 compressed formats
- Invalid formats → falls back to default state
- Encoding is async: URL updates happen asynchronously to avoid blocking UI
- Decoding is event-driven: Compressed URLs trigger async decompression with custom events
- Race condition handling: Handles cases where decompression completes before React event listeners are set up
- Favicon animation: Special handling ensures animated favicon works with all formats