UNPKG

snowfallreact

Version:

A React package for creating highly customizable snowfall effects. Perfect for adding a touch of winter magic to your web applications. Compatible with Next.js and ideal for enhancing the user interface with dynamic, seasonal visuals. Easy to integrate an

97 lines (65 loc) 3.5 kB
Sure! Here's a beautiful and detailed `README.md` for your `Snowfall` React component package. --- # Snowfall React Component `Snowfall` is a customizable React component that creates a snowfall effect using a custom image. The component allows you to adjust various properties such as the wind speed and direction to create a realistic snowfall simulation. ## Features - Customizable snowfall effect - Adjustable wind speed and direction - Easy to integrate into any React project ## Installation To install the package, run: ```bash npm install snowfallreact ``` ## Usage Here's how you can use the `Snowfall` component in your React application. ### Importing the Component First, import the `Snowfall` component and your custom snowflake image. ```jsx import React from 'react'; import Snowfall from 'snowfallreact'; import snowflakeImage from './path/to/your/snowflake.png'; // Replace with the actual path to your image ``` ### Using the Component You can use the `Snowfall` component in your application and customize it with the available props. ```jsx const App = () => { return ( <div className="App"> <h1>Snowfall Effect in React</h1> <Snowfall imageSrc={snowflakeImage} windSpeed={2} windDirection={45} particleCount={20} /> </div> ); }; export default App; ``` ## Props The `Snowfall` component accepts the following props to customize the snowfall effect: | Prop | Type | Default | Description | |-----------------|----------|---------|-----------------------------------------------------------------------------| | `imageSrc` | `string` | Required| The path to your custom snowflake image. | | `windSpeed` | `number` | `0` | The speed of the wind that affects the horizontal movement of the snowflakes. | | `windDirection` | `number` | `0` | The direction of the wind in degrees. 0 degrees is to the right, 90 degrees is down, 180 degrees is to the left, and 270 degrees is up. | | `particleCount` | `number` | `17` | The number of snowflake particles to generate. | ### Example ```jsx <Snowfall imageSrc={snowflakeImage} windSpeed={2} windDirection={45} particleCount={20} /> ``` ### Description of Props - **`imageSrc`**: This prop is mandatory. It should be the path to the image you want to use as the snowflake. - **`windSpeed`**: This prop controls how fast the wind blows. A higher number means stronger wind. - **`windDirection`**: This prop controls the direction of the wind. Use degrees to set the direction. For example, `0` means the wind blows to the right, `90` means the wind blows downwards, etc. - **`particleCount`**: This prop controls the quantity of the particles. For example, `10` means there will be 10 particles and `20` means there will be 20 particles present in the animation and so on. ## Contributing If you have suggestions for improvements or find a bug, please open an issue or submit a pull request. ## License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. ## Author Developed by [Etzshally](https://shahpaal.vercel.app). Feel free to contact me for any queries. --- This `README.md` provides comprehensive instructions on how to install, use, and customize the `Snowfall` component, making it easy for users to integrate it into their projects. Adjust the package name and image path as necessary.