Snow with HTML Canvas

On the HTML5 Rocks webite they've added snow to the main banner area.

It's very interesting to see how they've done it, you can get some ideas for your next project.


Canvas to the rescue

Yep, this black magic snow uses HTML canvas to create the area where the snow is gonna fall. So first of all we need a container:

That's it, next thing...

Sweet JavaScript

No libraries, frameworks or any dirty code. Just plain and simple JavaScript. You'll probably want some information about Canvas first so here it is:

Now ready or not here comes the code:

View Demo

About Rick

Senior Front-end Software Engineer from Barcelona, Haidong Gumdo Instructor (korean martial art of the sword), street photographer, travel lover, TV addict, Boston Red Sox fan, and privacy advocate.

Leave a Reply

Add <code> Some Code </code> by using this tags.