A little library that can be used for bursting particles effects on buttons and other elements

Overview

Particle Effects for Buttons

Bursting particles effects for buttons. By Luis Manuel.

Particle Effects

Article on Codrops

Demo

Credits

Basic usage

The Particles library depends on anime.js to perform animations, so you need to include it before Particles. Also, please make sure to include all the scripts at the end of the body element.

Then you can start disintegrating/integrating things like:

<!-- Normal HTML element to disintegrate -->
<button class="button">Button</button>

<script src="anime.min.js"></script>
<script src="dist/particles.min.js"></script>
<script>
    // Initialize a new instance of Particles to disintegrate/integrate the button
    var particles = new Particles('.button');

    // Disintegrate the button into particles
    particles.disintegrate();

    // particles.integrate(); // would do the opposite
</script>

Options

For customization, you can pass options to Particles constructor. That options will override the default values, and will be used for any future operation (disintegrate or integrate). You can also override the options for a specific operation. Here is the complete list of options available:

Name Type Default Description
canvasPadding Integer 150 Padding for the generated canvas that will be positioned right behind the target element. A canvasPadding = 0 will cause the canvas and the target element to have the same dimensions.
duration Integer 1000 Duration (ms) to perform the animations of target element and particles.
easing String or Function easeInOutCubic Easing function to perform the animation of target element. It will be passed directly to anime.js.
type String circle Type of particle. Could be any of the following values: circle, rectangle, triangle
style String fill Style of particle. Could be any of the following values: fill, stroke.
direction String left Direction to start disintegrating the element. Could be any of the following values: left, right, top, bottom. The opposite direction will be used to perform the integrate operation.
size Float or Function Random from 1 to 4 Size (px) for particles.
speed Float or Function Random from -2 to 2 Pixels per frame that a particle will be moved. It could be a function to set it randomly per particle (as default value).
color String Target's background-color Color used to fill the particles.
particlesAmountCoefficient Float 3 A coefficient to calculate the amount of particles to animate. A particlesAmountCoefficient = 0 will result in 0 particles, while bigger values will increase the amount of particles.
oscilationCoefficient Float 20 A coefficient to calculate the oscilation of particles while animating. A oscilationCoefficient = 0 will result in no oscilation (straight movements), while bigger values will increase the oscilation, resulting in a kind of randomness.
begin Function undefined Execute a function at the beginning of the animation.
complete Function undefined Execute a function at the end of the animation.

Wrapper for popular Javascript frameworks

Thanks to amazing contributors, the library can be used easily in the following popular Javascript frameworks:

License

This resource can be used freely if integrated or build upon in personal or commercial projects such as websites, web apps and web templates intended for sale. It is not allowed to take the resource "as-is" and sell it, redistribute, re-publish it, or sell "pluginized" versions of it. Free plugins built using this resource should have a visible mention and link to the original work. Always consider the licenses of all included libraries, scripts and images used.

Misc

Follow Luis: Twitter, GitHub

Follow Codrops: Twitter, Facebook, Google+, GitHub, Pinterest, Instagram

© Codrops 2018

Comments
  • How do I use this effect for  buttons on my website?

    How do I use this effect for buttons on my website?

    I tried manipulating this code but I could only make it work if it was in it's own index.html and unaltered. It stops working even if I remove all the buttons but one. Can you please guide me on how to use it on my website? I really like it.

    opened by albertcoder 4
  • Fixed issues in CSS/JS

    Fixed issues in CSS/JS

    I made some fixes in CSS (like duplicating style properties) and some refactor. Also, I refactored index and particles.js. In particles.js I did some work with variables.

    opened by sierikov 3
  • React Version 👋

    React Version 👋

    Hey guys,

    I really liked this effect, so I ported it to React: react-particle-effect-button.

    I tried to make it clear that it was a port and included links to the original article / author / source, but please let me know if you'd like me to include any additional disclaimers or legal info.

    Let me know what you think and if it'd be cool to add a link to the react version in the readme.

    Thanks!

    opened by transitive-bullshit 3
  • Page Redirection

    Page Redirection

    Hello! Loved this project, just a small query..

    I'm using these buttons for my hybrid app to link them to other pages.. How can we first show the entire button burst effect and then take them to the desired location? Is there any way?

    Thank you so much!

    opened by jessicalily 1
  • complete can not use?

    complete can not use?

    const arrOpts = [ { type: "triangle", style: "stroke", direction: "top", size: 5, color: "red", duration: 1400, speed: 1.5, oscillationCoefficient: 15, direction: "left", begin: function(e) { console.log(e); // translate(); }, complete: function(e) { console.log(e); // translate(); } } ];

    the begin can use ,but the complete can't;

    opened by kangaroo711 1
  • Transparent lines on canvas

    Transparent lines on canvas

    I found some lag on canvas when it is drawn. It ads transparent lines. Here is screenshots:

    2018-07-16 14 51 19 2018-07-16 14 54 44

    Tested in chrome browser on different machines. Chrome: 67.0.3396.99 Chrome canary: 69.0.3493.0 (same effect)

    Other browsers: Safari, Firefox - everything okay.

    opened by wsjscss 1
  • Increasing particle due to performance problem

    Increasing particle due to performance problem

    here is the situation:

    I trigger the btn in the same page several times,and I find out the particle doesn't destroy during one trigger,which make the page slower.

    hope to solve this problem soon! I'll make a PR if possible.

    opened by ACERY1 1
  • Added option for color to be a function

    Added option for color to be a function

    This pull request adds the option for the color to be a function. Combined with Math.random() it provides a way to color the particles in multiple colors.

    Also, the demo page is updated to show the usage.

    opened by hrastnik 1
Performant Particles: 3 to 6 times faster than tsParticles or Particles.js

perParticles Performant Particles is a demo that was written to handle a comparatively large amount of particles without slowing down to the same degr

Alaric von Teplitz 28 Oct 2, 2022
Javascript library to generate an infinite stream or a burst of image based particles on HTML canvas.

spxparticles Stream or a burst of image particles on HTML canvas Simple Javascript library for generating an infinine stream or a burst of image based

Tuomo Kulomaa 3 Dec 3, 2020
A vanishing effect for particles and magic lovers using Threejs, GSAP and custom shaders.

Three.js Experiment - Vanishing Suzanne Demo version Get started First, you need nodejs on your computer to build the assets. Install dependencies: np

Arno Di Nunzio 120 Dec 23, 2022
React particles animation background component

particles-bg React component for particles backgrounds This project refers to the source code of the Proton official website, I packaged it into a com

lindelof 561 Dec 24, 2022
A vue.js particles animation background component

particles-bg-vue A vue.js particles animation background component. Use it to make your website look cool. Check it out if you want to use it in React

lindelof 206 Dec 24, 2022
Lightweight, High Performance Particles in Canvas

Sparticles https://sparticlesjs.dev Lightweight, High Performance Particles in Canvas. For those occasions when you ?? just ?? gotta ?? have ?? sparkl

Simon Goellner 171 Dec 29, 2022
A lightweight, efficient and easy-to-use Canvas library for building some cool particle effects.

JParticles · 中文 | English 官网:jparticles.js.org 特效列表 粒子运动 波纹运动 波纹进度条 雪花飘落 线条动画 介绍 JParticles(JavaScript Particles 的缩写)是一款基于 Canvas 的不依赖于其他库的轻量级 JavaScr

花祁 466 Dec 27, 2022
A JavaScript library for advanced 2D slideshow with WebGL, that provides variety of beautiful effects

gl-slideshow An advanced 2D slideshow with WebGL, provides a variety of beautiful effects with GLSL power. Shaders are forked from https://gl-transiti

Akihiro Oyamada 68 Nov 28, 2022
A JavaScript library for advanced 2D slideshow with WebGL, that provides variety of beautiful effects

gl-slideshow An advanced 2D slideshow with WebGL, provides a variety of beautiful effects with GLSL power. Shaders are forked from https://gl-transiti

Akihiro Oyamada 69 Jan 1, 2023
A set of buttons with a magnetic interaction and a hover effect.

Magnetic Buttons A small set of magnetic buttons with some fun hover animations. Inspired by the button animation seen on Cuberto. Article on Codrops

Codrops 405 Dec 24, 2022
image/video/content slideshow engine providing high quality animation effects including Kenburns Effect and GLSL Transitions.

Diaporama Diaporama is an image/video/content slideshow engine providing high quality animation effects including Kenburns effect and GLSL Transitions

Gaëtan Renaudeau 797 Nov 26, 2022
Simple styles and effects for enhancing text input interactions.

Text Input Effects Simple styles and effects for enhancing text input interactions. Article on Codrops Demo Integrate or build upon it for free in you

Codrops 966 Jan 4, 2023
Some experimental rain and water drop effects in different scenarios using WebGL, by Lucas Bebber.

Rain & Water Effect Experiments Some experimental rain and water drop effects in different scenarios using WebGL, by Lucas Bebber. Article on Codrops

Codrops 1.4k Jan 4, 2023
A set of effects for mouse-following image trails that show a random series of images.

Image Trail Effects A set of effects for mouse-following image trails that show a random series of images. Inspired by the effect seen on VLNC Studio.

Codrops 177 Dec 28, 2022
Only 90's kids remember... well not really, but these beloved effects that would follow your mouse around will always be classic reminders of the old, beloved internet.

90's Cursor Effects "Knowing the codes" used to be all the rage, I want to bring a few back. A repo of the old effects that inspired creativity and th

Tim Holman 2.6k Jan 9, 2023
A set of playful dragging effects for images using various techniques.

Image Dragging Effects A set of playful effects for dragging images. Article on Codrops Demo Installation Install dependencies: npm install Compile t

Codrops 71 Dec 4, 2022
Demonstration of different animation effects with AngularJS ngView directive.

ngView-animation-effects This is a simple demonstration of how easy you can make your ngView directive transition pages with nice animations. All you

Aliaksandr Astashenkau 184 Dec 31, 2022
Loading effects for assets including some built in animated reveals

Asset loading effects This is a library to show the loading progress of given assets and reveal them using various animations. Please give feedback, r

Zach Saucier 97 Dec 8, 2022
Live input Web Audio effects

Live Audio Input effects I whipped this app up to test live audio input, letting the user select a few common tunable effects and see (and hear) the e

Chris Wilson 488 Dec 22, 2022