The timestamp is updated every 5 seconds, and a new random ‘artwork’ is created. To generate what appears to be randomness, the date and time are transformed into a large hexadecimal number by your device using the cryptographic algorithm SHA-256. This algorithm is deterministic, meaning it will always produce the same 256-bit number for the same input, even though the result looks completely random. SHA-256 is often used to ensure data integrity, such as verifying that a file remains unchanged.
Pattern Seed: The first 8 digits of the hash are used as a seed in css-doodle to generate a 5x5 pixel grid, where each pixel can be one of three colours. This allows for more than 847 billion possible variations (325). The grid is then copied, mirrored, and overlapped three additional times to create a symmetrical pattern.
Hue: Digits 9 to 16 of the SHA-256 hash are used to determine the hue. The value is modulated with 360 to fit within the color wheel. The addition of a randomly selected third colour further increases the number of unique patterns that can be generated.
Saturation: Digits 17 to 24 of the SHA-256 hash are used to determine the saturation. The value is modulated with 51 and then added to 50 to give a saturation between 50% and 100%.
Lightness: Digits 25 to 32 of the SHA-256 hash are used to determine the lightness. The value is modulated with 31 and then added to 40 to give a lightness between 40% and 70%.
Export: The 'Download PNG' button uses HTML Canvas to export the current Timestamp.
Learn more: SHA-256, css-doodle, HSL colors, HTML5 Canvas.