npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-canvas-js

v1.0.1

Published

:rocket: Awesome HTML Canvas Particle animation in React!

Downloads

196

Readme

react-canvas-js (demo)

:rocket: Awesome HTML Canvas animations in React!

NPM JavaScript Style Guide

Install

npm install --save react-canvas-js

Usage

import React, { Component } from 'react'
import Canvas from 'react-canvas-js'

const particleOptions = [
  {
    'maxParticles': 50,
    'colors': ['#2E1D62', '#513D91', '#487EEF', '#11A887', '#fc5c65', '#fed330'],
    'shapes': ['circle', 'square'],
    'size': 10,
    'minSpeed': 0.05,
    'maxSpeed': 0.20,
    'alpha': 0.70,
    'backgroundColor': '#1E1F29'
  }
]

class Example extends Component {
  render () {
    return (
      <Canvas options={particleOptions} />
    )
  }
}

Available Options

Option | Type | Required | Default | Description ------ | ---- | -------- | ------- | ----------- precision | Number | No | 2 | The precision to use for all float values in the component. backgroundColor | String | No | '#f1f1f1' | The background color for the canvas. maxParticles | Number | No | 50 | Maximum number of particles to include in Animation. color | String | No | One of ['red', 'green', 'yellow'] | The color for all Particles. colors | [String] | No | ['red', 'green', 'yellow'] | The range of colors to randomly pick for each particle. shape | Object/String | No | One of ['circle', 'square', 'rectangle'] | The Shape of the particle. shape.type | String (One of ['image', 'rectangle', 'square', 'circle']) | No | null | The shape type (supported shapes are ['image', 'rectangle', 'square', 'circle']). shape.src | String | No / Yes (if type === 'image') | null | The image src, if type is set to image. shape.size | Number || Object | No | Inherits Parent size property. | The size of the particle. shape.size.width | Number | No | Inherits Parent size property. | The width of the particle. shape.size.height | Number | No | Inherits Parent size property. | The height of the particle. shape.size.radius | Number | No | Inherits Parent size property. | The radius of the particle if shape is 'circle'. shape.color | String | No | Inherits Parent color property. shapes | [Object/String] | No | ['circle', 'square', 'rectangle'] | The range of shapes to randomly pick for each particle. minSize | Number | No | 10 | The minimum size (range) for the particle sizes, to be picked at random (if size not defined). maxSize | Number | No | 10 | The maximum size (range) for the particle sizes, to be picked at random (if size not defined). minSpeed | Number | No | 0.05 | The speed for each particle is taken at random in between the min(Speed) / max(Speed) range maxSpeed | Number | No | 0.09 | The speed for each particle is taken at random in between the min(Speed) / max(Speed) range alpha | Number | No | 0.5 | The alpha/transparency for the canvas particles/elements. debugOptions | Object | No | null | Developer Debugging options debugOptions.enabled | boolean | Yes | false | Enables debugging, and binds a Particle object to window.Particle to inspect. debugOptions.attachAllParticles | boolean | No | false | Binds all the Particle objects to window.Particles. debugOptions.showFrameRate | boolean | No | Shows a frame rate blurb over the canvas, indicating the frame rate achieved by that canvas.

Planned Features (checklist)

  • [ ] Add interaction support.
    • [ ] Add support for custom hover handler (#1).
    • [ ] Add support for custom click handler (#2).
    • [ ] Add support for custom Keyboard key(s) handler (#3).
  • [ ] Add tests (#4).
  • [ ] Identify possible Optimizations (#5).
  • [ ] Particle/subject animation control, i.e. Support for controlling movement, scale and transform of Particle/subject from current given x,y coordinates to xn, yn coordinates over given duration or speed (#6).

My goal is to progress to more than just Particle animation, by simplifying and adding support for all canvas animation use cases. Suggestions and feedback are welcome too.

Contributing

I could use some assistance in building and improving this component. I'll welcome pull requests for bug fixes, new features, improvements and writing test cases. If you are interested head on over to the Issues section, and pick up any of the issue(s) that interest you. The issues with label need help could really do with some help (as the label suggests). Please create your pull requests to the develop branch. Top Contributors will be added here under the contributors section (if you'd like that).

Author

Shalom Sam

  • Checkout my Full Stack Web Developer Website
  • You can checkout this React Portfolio here
  • A scope of my work @ React Portfolio

License

MIT © shalomsam