Ben Borgers / Posts /

How to add falling snow to a website with JavaScript

February 1, 2021 by @benborgers

I wanted to add a snowing animation to my website, but I didn't want to code it myself. Instead, I found a nice package called let-it-go to do it for me.

Just install the package:

npm i let-it-go

And then start the confetti:

import { LetItGo } from 'let-it-go'

new LetItGo({
    color: '#94a3b8'
    /* color is optional (the snow is white by default),
       but since my website was white I needed gray snow for contrast */
})

There's more options for stopping and styling the snow in the let-it-go docs.

A quick favor: was anything I wrote incorrect or misspelled, or do you still have questions? Please use this form to let me know or ask for help!

Loading...