This is exercise 2.14 from Java Solutions for AP Computer Science (John Lewis, William Loftus, Cara Cocking), which originally involved making a handful of small tweaks to a Java applet that draws a snowman: moving the sun to the other side, moving the snowman slightly, adding buttons to the snowman, and changing the snowman's expression.
I took things a little further, looking up Java animation techniques to make it snow and also make the snowman wave and occasionally blink. Making the snowman frown seemed out of place to me with such a cheery winter scene, so I also made it possible to throw snowballs at the snowman by clicking anywhere in the applet.
Though Java applets are dead and no modern browser will run the original applet from ten years ago, I've translated the code to JavaScript so you can still experience it above.
External Sources
- Background music: Jingle Bells by Kevin MacLeod (incompetech.com), 🅭🅯 4.0
- Snowflake sprite: Koch_snowflake.png by Arbol01, 🅭🅯🄎 3.0, background removed and scaled to 10×10px
- Snowball sound effect: Batman Punch by CGeffex, Sampling Plus 1.0