Color Pattern Generator
Mixes six math-defined color patterns into 64×64 images, using the input and output shape of a GAN generator.
Not a trained GAN. There is no discriminator and no training. The weights are set by hand. The page shows how a small network can map a random vector to an image; the image is a weighted mix of six fixed color patterns.
How it works
| Step | What the code does |
|---|---|
| Random vector | 8 numbers in [-1, 1] from a seeded random generator (Mulberry32). Same seed, same images. |
| Hidden layer | A fixed 8×8 weight matrix plus bias, then tanh. |
| Output layer | A fixed 6×8 weight matrix plus bias, then tanh. The 6 results are scaled so their absolute values sum to 1. |
| Base patterns | Six 64×64 color patterns built from sine and polar formulas: spiral, starburst, ripple, interference, orbit, plasma. |
| Output | Each pixel is the weighted sum of the six patterns, multiplied by the energy setting. |
Controls
- Seed: picks the random vectors. Each seed gives 6 images.
- Energy: multiplies all pattern weights. Higher values give stronger color; very high values clip to full brightness.
- Generate frame: adds 53 to the seed.
- Randomize seed: picks a random seed.
- Autoplay: adds 97 to the seed every 1.4 seconds. It stops when the tab is hidden.
- Coefficient readout: the 6 pattern weights for each image.
Demo
1.00
Coefficient readout
Notes
- The patterns are computed in the browser, so no image files are downloaded.
- All math uses typed arrays in plain JavaScript. No WebGL or WebAssembly.