Extra credit to anyone who can implement this in HTML/CSS without using the canvas element. Since CSS transformations are hardware accelerated, I bet it can be made to look as smooth as the reference GIF.
Several years ago I made a very silly simple Christmas tree in HTML/CSS, with <blink>ing lights and Unicode ornaments, and my friend made a way to place your own choice of "ornaments": http://unicodexmas.com/