Skip to content
This repository has been archived by the owner on Jun 14, 2021. It is now read-only.

Fancy snowfall React component from Frank Sinatra.

License

Notifications You must be signed in to change notification settings

smikhalevski/react-snowflakes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Snowflakes

Frank Sinatra

“Let it snow on your React website!” – Frank Sinatra1

How to use?

import {DepthOfFieldSnowfall} from 'react-snowflakes';

// Insert anywhere in your code and that's it!
<DepthOfFieldSnowfall count={50}
                      style={{
                        // Position must be relative or absolute,
                        // because snowflakes are positioned absolutely.
                        position: 'relative',
                        width: '300px',
                        height: '300px'
                      }}/>

You can have more control over snowflakes with Snowfall:

import {Snowfall, Snowflake} from 'react-snowflakes';

<Snowfall count={50}
          style={{
            position: 'relative',
            width: '300px',
            height: '300px'
          }}
          snowflakeFactory={index => {
            const size = index / 50; // 50 is the number of snowflakes.
            const w = 5 + 10 * size + 'px';
            return (
              <Snowflake speed={.05 + size * 2}
                         xSpeedPrc={.3 * size}
                         ySpeedPrc={.1 * size}
                         style={{
                           width: w,
                           height: w,
                           borderRadius: '50%',
                           backgroundColor: 'white',
                           opacity: .2 + .8 * size,
                           filter: `blur(${Math.round(Math.max(size - .5, 0) * 15)}px)`
                         }}/>
            )
          }}/>

License

The code is available under MIT licence.

About

Fancy snowfall React component from Frank Sinatra.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published