daniel-lundin/react-dom-confetti
daniel-lundin/react-dom-confetti has 620 GitHub stars and 29 forks. GitHot measured 0 stars in 24 hours. Last checked 2026-11-20 15:03 UTC. Last push 2022-12-06.
实测星标增长
- 24小时
- 0
- 7天
- 正在收集历史
- 15天
- 正在收集历史
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
关于
Trigger confetti explosions on state transitions
开发工具README.md
原文react-dom-confetti
Trigger confetti explosions on state transitions:
import Confetti from 'react-dom-confetti';
// in render
<Confetti active={ this.props.completed } />
This component will trigger a confetti explosion every time the prop active goes from a falsy to truthy value.
Demo
https://daniel-lundin.github.io/react-dom-confetti/
Why?
Slow operations annoy users and stakeholders. We have two options, either optimize slow operations or make it worth the wait. This library focuses on the latter.
Props
active
Required. Triggers an explosion when the prop transitions from falsy to truthy.
config
Optional. Configuration object to control the characteristics of the confetti:
angle- direction of the explosion in degrees, defaults to 90.spread- spread of the explosion in degrees, defaults to 45.startVelocity- Initial velocity of the particles, defaults to 45.width: - width of the confetti elementsheight: - height of the confetti elementselementCount- Number of particle elements, defaults to 50.decay- deprecated - Decrease in velocity per frame, defaults to 0.9 (Use of this will disable dragFriction)dragFriction- Decrease in velocity proportional to current velocity, default to 0.1delay- deprecated Use stagger instead.stagger- Delay for each fetti in milliseconds, defaults to 0.random- Randomization function, defaults to Math.randomcolors- An array of color codes, defaults to['#a864fd', '#29cdff', '#78ff44', '#ff718d' '#fdff6a']
License MIT, copyright Daniel Lundin 2017