Canvas Animation: Particle Emitter #3

An interactive particle emitter animation rendered on an HTML5 canvas element. The visual experience is centred around particles that emanate from the middle of the canvas and disperse in random directions, creating a dynamic and engaging display.

Each particle moves with a randomly assigned velocity in both the horizontal (x) and vertical (y) directions, resulting in a scattered trajectory. Particles are small squares of size 1 by default, with a 5% chance of being size 2, adding slight variation to the visual texture. Particles are rendered in semi-transparent white, with opacity levels randomly set between 0.3 and 0.7. This creates a subtle glow effect against the dark background. Each particle has a randomly determined lifespan ranging from 10 to 510 frames. Once a particle exceeds its lifespan, it fades away, maintaining the fluidity of the animation. The canvas has a solid dark bluish-gray background colour (rgba(40, 42, 54, 1)), providing a stark contrast to the luminous particles.

A range input slider allows users to set the number of particles in the animation. Adjusting this slider dynamically updates the particle count and restarts the animation with the new settings after a brief delay.

Another range input slider enables users to control the duration of the animation in frames. Similar to the particle count, changing this value restarts the animation to reflect the new duration.

A third control allows the user to add an accent colour to the animation.

animation canvas javascript

Comments

New Comment

If you have a comment you'd like to share, feel free to leave it below. I moderate all comments before they are published. Markdown is enabled. See syntax for help.


I'll never share your email with anyone else.

Web Demos

My web demos exist as a playground for creating experiments written in HTML, CSS and JavaScript.

I have previously used CodePen for experimenting with HTML/CSS/JavaScript, but in the spirit of IndieWeb POSSE, I decided to start hosting my demos myself.

Folksonomy

I like tag all content on my site. See below for all tags used within my web demos.

Subscribe

Click the link below to subscribe to my Demo feed in your favourite news reader client:

RSS feed

Philip Newborough and a donkey enjoying a beer.

About

My name is and I’m a full stack web developer living and working in Lincoln, England. This website (philipnewborough.co.uk) serves as my personal homepage. When I’m not working with tech, I love to ride bicycles with my wife and friends.

← An IndieWeb Webring πŸ•ΈπŸ’ β†’