Zach’s ugly mug (his face) Zach Leat­herman

<snow-fall> Web Component

A snowy landscape with a variety of evergreen trees behind a small lake.
5k 1416 December 15, 2023
🚾Web Component@zachleat/snow-fall

A web component to add snow to your web site (or to an element on your web site).

All🚾 0.1%
Popularity
npm11k Monthly downloads sparkline for @zachleat/snow-fall, ranging 385 to 2k cdn2k Monthly jsDelivr CDN hits sparkline for @zachleat/snow-fall, ranging 18 to 961
Versions
4 versions in
1.0.3
Audit
0 reports
0 deps
Issues
4
PRs
0

<snow-fall> is a zero-dependency, JavaScript web component to add snow to your web site (or to an element on your web site). This is a web component implementation of this Codepen from alphardex.

Usage

<script type="module" src="snow-fall.js"></script>

<!-- Add snow to the page -->
<snow-fall></snow-fall>

<!-- Add snow to the first child element -->
<snow-fall>
	<div style="width: 300px; height: 300px">
</snow-fall>

Installable from npm:

npm install @zachleat/snow-fall

Use with <is-land>

This is best used with <is-land> to respect user preferences for reduced motion:

<is-land on:media="(prefers-reduced-motion: no-preference)">
	<snow-fall></snow-fall>
</is-land>

Change the snow color

<!-- Change snow color -->
<snow-fall style="--snow-fall-color: rebeccapurple"></snow-fall>

Change the number of snowflakes

<!-- Default: 100 -->
<snow-fall count="200"></snow-fall>

Change the size of the snowflakes

Added in v1.0.2

<!-- Default: 10px -->
<snow-fall style="--snow-fall-size: 20px"></snow-fall>

Force the rendering mode (page/element)

You probably don’t need this.

<snow-fall mode="page"></snow-fall>
<snow-fall mode="element"></snow-fall>

IndieWeb Avatar for https://unsplash.com/Poster image by Adam Chang

< Older
One YouTube Embed weighs almost 1.2 MB
Newer >
Eleventy v3 with ESM support now on the canary channel

Zach Leatherman IndieWeb Avatar for https://zachleat.com/is a builder for the web at Font Awesome and the creator of Build Awesome (née IndieWeb Avatar for https://www.11ty.devEleventy/11ty), an award-winning open source website generator. He measures website performance with speedlify and at one point became too fixated on web fonts. He has given 89 talks in nine different countries at events like Beyond Tellerrand, Smashing Conference, Jamstack Conf, CSSConf, and The White House. Formerly part of CloudCannon, Netlify, Filament Group, NEJS CONF, and NebraskaJS. Learn more about Zach »

14 Reposts
biouBox464Michaelfromjason.xyz ❤️ ????JelleiamdtmsJasonBob MonsourJean Pierre KolbFynn Ellie BekirchErik (????????????‍????????)Bob MonsourNilesh Prajapati
34 Likes
Go4KnowNathan BottomleyMarcoSimon Cox :SEO:Marc LittlemoreCodeMonumentSergioGeoff RichdgrammatikoIllya BusiginDanaMindi Rogers GreenMichaelDavid M. Schulman ????luciMarco HengstenbergTommoonglumPatrick FultoniamdtmsBenjamin AndrewJürgen ŠuvalovThomas BroyerAlexander DraperErikaFynn Ellie BeNathan KnowlerErik (????????????‍????????)kirchGregStephCRobb OwenNilesh Prajapati
16 Comments
  1. Robb Knight
    Robb Knight

    @zachleat I just remembered I made this last year https://emojistorm.rknight.me EmojiStorm

  2. Zach Leatherman :11ty:
    Zach Leatherman :11ty:

    @robb hell yeah you did

  3. Zach Leatherman :11ty:
    Zach Leatherman :11ty:

    if you look in the footer of https://blog.fontawesome.com/ and tap on the Font Awesome flag you’ll see a variant of this component made to work with Font Awesome icons (and reusing the colors from the header image of the blog post too: https://blog.fontawesome.com/blog-awesome-to… Truncated

  4. Zach Leatherman
    Zach Leatherman

    if you look in the footer of blog.fontawesome.com and tap on the Font Awesome flag you’ll see a variant of this component made to work with Font Awesome icons ???? (and reusing the colors from the header image of the blog post too: blog.fontawesome.com/blog-awesome...)

  5. Ross McKay
    Ross McKay

    @zachleat it was 38°C today and tomorrow is forecast for 39°C with more fires. Are you sure that's not ash? Tis the season.

  6. Zach Leatherman :11ty:
    Zach Leatherman :11ty:

    @webaware let’s not read too much into the fact that I accidentally implied that everyone in the southern hemisphere might not be my friend *runs away screaming*

  7. Marco Hengstenberg
    Marco Hengstenberg

    @zachleat I recently added an SVG Rudolph with shiny blinky red nose to a website. If you clicked the nose hearts would emit from it in all directions. My PM:"How long did it take you to build that? It wasn't part of the plan to do this. Why is it even there?" The C… Truncated

  8. Zach Leatherman :11ty:
    Zach Leatherman :11ty:

    @nice2meatu hahahahahaha ????????????????

  9. Marco Hengstenberg
    Marco Hengstenberg

    @zachleat altogether now "It's the moooost wonderful tiiiiime of the yeeeaaaaar"!

  10. Stefan Bohacek
    Stefan Bohacek

    @zachleat Nice!

  11. Benjamin Andrew
    Benjamin Andrew

    Ha, this just reminded me to turn on my toolbar lights. festivitas.app

  12. Zach Leatherman
    Zach Leatherman

    Lovely!

  13. Alex Guyot
    Alex Guyot

    @zachleat Excellent, thank you ???? ❄️ https://unapologetic.io Unapologetic

  14. iamdtms
    iamdtms

    @zachleat Ready. Light/dark theme implementation is as easy as it can be. Predefining two HTML nodes or update one node selector. Finally writing some CSS lines: --snow-fall-color for color value or variable. Perfect, big thank you!

  15. Frank // Mottokrosh
    Frank // Mottokrosh

    @zachleat I looked more closely, and can indeed see the snow on the body text occasionally. I guess since it's not so dense it simply isn't visible so much, whereas on larger dark areas it stands out more. Next time I'll examine more closely before yelling questions. … Truncated

  16. Used a couple of other web components too snow-fall web component from https://www.zachleat.com/web/snow-fall/ @zachleat color-input web component from https://github.com/argyleink/css-color-component?tab=readme-ov-file @argyleink snow-fall Web Component—zachleat.com

Shamelessly plug your related post

These are webmentions via the IndieWeb and webmention.io.

Sharing on social media?

This is what will show up when you share this post on Social Media:

How did you do this? I automated my Open Graph images. (Peer behind the curtain at the test page)