{"id":13409057,"url":"https://github.com/transitive-bullshit/react-particle-effect-button","last_synced_at":"2025-05-15T07:05:45.740Z","repository":{"id":57342277,"uuid":"131501807","full_name":"transitive-bullshit/react-particle-effect-button","owner":"transitive-bullshit","description":"Bursting particle effect buttons for React 🎉","archived":false,"fork":false,"pushed_at":"2023-10-26T21:23:35.000Z","size":3334,"stargazers_count":1511,"open_issues_count":5,"forks_count":97,"subscribers_count":24,"default_branch":"master","last_synced_at":"2025-04-14T11:12:55.379Z","etag":null,"topics":["button","canvas","codrops","particles","react"],"latest_commit_sha":null,"homepage":"https://transitive-bullshit.github.io/react-particle-effect-button/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/transitive-bullshit.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-04-29T14:33:31.000Z","updated_at":"2025-03-27T11:54:06.000Z","dependencies_parsed_at":"2023-12-25T13:18:44.301Z","dependency_job_id":null,"html_url":"https://github.com/transitive-bullshit/react-particle-effect-button","commit_stats":{"total_commits":24,"total_committers":3,"mean_commits":8.0,"dds":0.08333333333333337,"last_synced_commit":"39e8e4ce13cdafb0cd96668e8674d2084348a955"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Freact-particle-effect-button","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Freact-particle-effect-button/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Freact-particle-effect-button/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/transitive-bullshit%2Freact-particle-effect-button/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/transitive-bullshit","download_url":"https://codeload.github.com/transitive-bullshit/react-particle-effect-button/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254292041,"owners_count":22046426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["button","canvas","codrops","particles","react"],"created_at":"2024-07-30T20:00:57.649Z","updated_at":"2025-05-15T07:05:40.732Z","avatar_url":"https://github.com/transitive-bullshit.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Libraries","Repository","前端 \u003ca name=\"frontend\"\u003e\u003c/a\u003e","26. 按钮","📦 Legacy \u0026 Inactive Projects"],"sub_categories":["Particle animation","Animation","24.3 Web Sockets"],"readme":"# react-particle-effect-button ([demo](https://transitive-bullshit.github.io/react-particle-effect-button/))\n\n\u003e Bursting particle effect buttons for React.\n\n[![NPM](https://img.shields.io/npm/v/react-particle-effect-button.svg)](https://www.npmjs.com/package/react-particle-effect-button) [![Build Status](https://travis-ci.com/transitive-bullshit/react-particle-effect-button.svg?branch=master)](https://travis-ci.com/transitive-bullshit/react-particle-effect-button) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n[![Demo](https://raw.githubusercontent.com/transitive-bullshit/react-particle-effect-button/master/example/demo.gif)](https://transitive-bullshit.github.io/react-particle-effect-button/)\n\nThis library is a React port of an awesome [Codrops Article](https://tympanus.net/codrops/2018/04/25/particle-effects-for-buttons/) by [Luis Manuel](https://tympanus.net/codrops/author/luis/) (original [source](https://github.com/codrops/ParticleEffectsButtons/)).\n\n## Install\n\n```bash\nnpm install --save react-particle-effect-button\n```\n\n## Usage\n\nCheck out the [Demo](https://transitive-bullshit.github.io/react-particle-effect-button/) to see it in action.\n\n```jsx\nimport React, { Component } from 'react'\n\nimport ParticleEffectButton from 'react-particle-effect-button'\n\nclass App extends Component {\n  state = {\n    hidden: false\n  }\n\n  render () {\n    return (\n      \u003cParticleEffectButton\n        color='#121019'\n        hidden={this.state.hidden}\n      \u003e\n        BUTTON CONTENT GOES HERE\n      \u003c/ParticleEffectButton\u003e\n    )\n  }\n}\n```\n\nNote that `children` can be anything from a simple `\u003cbutton\u003e` to a complex React subtree. The `children` should represent the button's contents.\n\nYou change the `hidden` boolean prop to kick-off an animation, typically as a result of a click on the button's contents. If `hidden` changes to `true`, the button will perform a disintegrating animation. If `hidden` changes to `false`, it will reverse and reintegrate the original content.\n\n## Props\n\n| Property      | Type               | Default                               | Description                                                                                                                                  |\n|:--------------|:-------------------|:--------------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------|\n| `hidden`  | boolean           | false                                  | Whether button should be hidden or visible. Changing this prop starts an animation. |\n| `color`  | string           | '#000'                                  | Particle color. Should match the button content's background color |\n| `children`  | React Node           | undefined                         | The contents of the button. |\n| `duration`  | number           | 1000                                  | Animation duration in milliseconds. |\n| `easing`  | string           | 'easeInOutCubic'                        | Animation easing. |\n| `type`  | string           | circle                                  | 'circle' or 'rectangle' or 'triangle' |\n| `style`  | string           | fill                                  | 'fill' or 'stroke' |\n| `direction`  | string           | 'left'                                  | 'left' or 'right' or 'top' or 'bottom' |\n| `canvasPadding`  | number           | 150                                  | Amount of extra padding to add to the canvas since the animation will overflow the content's bounds |\n| `size`  | number | func           | random(4)                             | Particle size. May be a static number or a function which returns numbers. |\n| `speed`  | number | func           | random(4)                             | Particle speed. May be a static number or a function which returns numbers. |\n| `particlesAmountCoefficient`  | number    | 3                             | Increases or decreases the relative number of particles |\n| `oscillationCoefficient`  | number           | 20                         | Increases or decreases the relative curvature of particles |\n| `onBegin`  | func           | noop                                     | Callback to be notified once an animation starts. |\n| `onComplete`  | func           | noop                                  | Callback to be notified once an animation completes. |\n\nI tried to keep the properties exactly the same as in the original codrops version.\n\n## Related\n\n- [anime.js](http://animejs.com/) - Underlying animation engine.\n- [ParticleEffectsButtons](https://github.com/codrops/ParticleEffectsButtons/) - Original source this library is based on.\n- [Codrops Article](https://tympanus.net/codrops/2018/04/25/particle-effects-for-buttons/) - Original article this library is based on.\n\nThis module was bootstrapped with [create-react-library](https://github.com/transitive-bullshit/create-react-library).\n\n## License\n\nMIT © [Travis Fischer](https://github.com/transitive-bullshit)\n\nSupport my OSS work by \u003ca href=\"https://twitter.com/transitive_bs\"\u003efollowing me on twitter \u003cimg src=\"https://storage.googleapis.com/saasify-assets/twitter-logo.svg\" alt=\"twitter\" height=\"24px\" align=\"center\"\u003e\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Freact-particle-effect-button","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftransitive-bullshit%2Freact-particle-effect-button","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftransitive-bullshit%2Freact-particle-effect-button/lists"}