I’ve submitted my code to JS1K (JavaScript 1KB) 2013-spring contest.
My submission is a parallax scroller with multiple repeating background layers composited on a single canvas : Starfield, Fractal mountains, IFS trees.
JS1K was a yearly JavaScript code golfing competition: a demo in at most 1,024 bytes of JavaScript, judged by a jury of JavaScript developers and demosceners. The 2013 edition had the theme “Spring”, and my entry takes 987 bytes.
To save bytes, the seven layers are drawn only once, on hidden canvases, then used as CSS background images of the page canvas: the animation only moves their positions, at a different speed for each layer. The fractal mountains come from a midpoint displacement, and the trees are drawn recursively. The code also uses the abbreviation of the canvas methods by Marijn Haverbeke, and its own seedable random number generator.
Run it in your browser
More about it
