More Premium Hugo Themes Premium React Themes

React Canvas Confetti

React component for canvas-confetti library

React Canvas Confetti

React component for canvas-confetti library

Author Avatar Theme by ulitcos
Github Stars Github Stars: 259
Last Commit Last Commit: Mar 8, 2024 -
First Commit Created: Dec 18, 2023 -
React Canvas Confetti screenshot

Overview:

The react-canvas-confetti is a React component that allows users to integrate the canvas-confetti library into their React applications. This component provides an interface for creating and controlling confetti animations on a canvas element. Users can customize various parameters such as the number of confetti, angle, spread, start velocity, decay, gravity, drift, and origin. The react-canvas-confetti component offers two use cases: using callbacks to control the animation from the parent component or directly manipulating the component’s props to control the animation.

Features:

  • Callback for Getting the Canvas-Confetti Instance: Users can use the confetti prop to get the canvas-confetti instance into the parent component, allowing them to control the animation programmatically.
  • Animation Control Props: Users can use the fire prop to start the animation, the reset prop to reset all animations at once, and the onFire, onDecay, and onReset callbacks to trigger custom actions on animation events.
  • Canvas Size Control: Users can set the width and height of the canvas using the width and height props, or they can use the className and style props for alternative ways to control canvas sizes.
  • Customization of Confetti Parameters: Users can customize various parameters of the confetti animation, such as the number of confetti, angle, spread, start velocity, decay, gravity, drift, ticks, and origin.

Installation:

To install the react-canvas-confetti component, make sure you have React already installed as a peer dependency. Then, you can install the component via npm by running the following command:

npm install react-canvas-confetti

Summary:

The react-canvas-confetti component provides a convenient way to integrate the canvas-confetti library into React applications. It offers various features such as animation control props, customization of confetti parameters, and callbacks for interacting with the animation from the parent component. With the react-canvas-confetti component, users can easily create and control confetti animations on a canvas element in their React applications.