Ready to execute
Hardware Heritage
Color cycling (or Palette Shifting) creates animation without moving a single pixel. The image data stored in video memory remains static; only the colors in the Color Look-Up Table (CLUT) are rotated frame by frame.
Zero CPU
Moving huge bitmaps was slow. Changing 3 values in a palette registry was instant. This allowed 8088 PCs to render flowing waterfalls and shimmering lights.
VGA DAC
The VGA card's RAMDAC (Digital to Analog Converter) held 256 colors. Games like SimCity 2000 used this for traffic and water animation.
Modern Logic
True 8-bit paletted modes don't exist in Canvas 2D. We simulate this by rewriting the pixel buffer from a source index array every frame.
Color Cycling
Animation via palette rotation.
Legacy C Code
// Rotate Palette entries 10-20
RGB temp = palette[20];
for(int i=20; i>10; i--) {
palette[i] = palette[i-1];
}
palette[10] = temp;
outp(0x3C8, 0); // Upload
for(int i=0; i<256; i++) {
outp(0x3C9, palette[i].r);
outp(0x3C9, palette[i].g);
outp(0x3C9, palette[i].b);
}