1.0.0 • Published 7 months ago

react-confetti-boom v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
7 months ago

React Confetti Boom 🎉

NPM NPM Downloads License Size

React Confetti Boom 🎉 is a lightweight and customizable confetti animation component for React applications. Enhance user experience by adding a fun and engaging confetti effect to your app with just a few lines of code.

boom modefall mode
boomfall

Table of Contents

Installation

To install React Confetti Boom, run the following command:

npm install react-confetti-boom

Usage

Import the Confetti component and add it to your JSX.

import React from 'react';
import Confetti from 'react-confetti-boom';

function MyApp() {
  return (
    <div>
      <h1>My React App</h1>
      <Confetti />
    </div>
  );
}

export default MyApp;

Live Demo

You can check out the live demo of react-confetti-boom in action on the following page: https://almond-bongbong.github.io/react-confetti-boom/

The demo page provides an interactive way to customize the confetti settings, such as starting position, particle count, angle, shape size, and colors. This helps you visualize how the confetti effect will look in your own project.

Props

NameTypeDefaultDescription
mode'boom' | 'fall''boom'Mode for confetti animation. 'boom' for explosion-like, 'fall' for rain-like effect
xnumber0.5Horizontal starting position of confetti as a ratio of canvas width (0 to 1)
ynumber0.5Vertical starting position of confetti as a ratio of canvas height (0 to 1)
particleCountnumber30Number of confetti particles to generate
degnumber270Initial angle (in degrees) at which particles are emitted
shapeSizenumber12Size of confetti particles
spreadDegnumber30Angle (in degrees) that particles can deviate from the initial angle (deg)
effectIntervalnumber3000Interval (in ms) between consecutive confetti bursts
effectCountnumber1Number of confetti bursts to render
colorsstring[]'#ff577f', '#ff884b', '#ffd384', '#fff9b0'Array of colors for confetti particles, in hex format
launchSpeednumber1Initial speed at which particles are launched

Example

import React from 'react';
import Confetti from 'react-confetti-boom';

function Celebration() {
  return (
    <div>
      <h1>Congratulations!</h1>
      <Confetti
        x={0.5}
        y={0.1}
        particleCount={50}
        deg={270}
        shapeSize={8}
        spreadDeg={45}
        effectInterval={2000}
        effectCount={3}
        colors={['#ff577f', '#ff884b', '#ffd384', '#fff9b0', '#3498db']}
      />
    </div>
  );
}

export default Celebration;

This example will render a confetti animation with 50 particles starting at 10% from the top of the canvas. The particles will be emitted at a 270-degree angle, with a 45-degree spread. The confetti bursts will occur every 2 seconds, for a total of 3 bursts. The confetti particles will use the provided array of colors.

License

This project is licensed under the terms of the MIT License.

1.0.0

7 months ago

0.0.6

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago