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 🙏

© 2024 – Pkg Stats / Ryan Hefner

metaballs-js

v2.0.0

Published

Animated Metaballs using WebGL

Downloads

7

Readme

metaballs-js

NPM License BundlePhobia Last Commit

Demo

Playground / Demo

Features

  • Create animated metaballs in all numbers, colors, sizes, velocities.
  • Light-weight: Written in plain WebGL without any other dependencies. BundlePhobia
  • Performant: Makes use of GPU hardware acceleration. The performance solely depends on the number of metaballs.

Install

npm install --save metaballs-js

Usage

import initMetaballs from "metaballs-js";

const options = {
  numMetaballs: 100,
  minRadius: 3,
  maxRadius: 7.5,
  speed: 10.0,
  color: '#ff0024',
  backgroundColor: '#121212',
  useDevicePixelRatio: true
}

const cssSelector = '#canvasId'
initMetaballs(cssSelector, options)

// in your HTML
<html>
  <body>
    <canvas id="canvasId"></canvas>
  </body>
</html>

Options

| Name | Description | Type | Default Value | | :------------------ | :--------------------------------------------------------------------------------------------------------- | :---------------- | :------------------------------------------------------------------: | | numMetaballs | The number of metaballs to display | Number | 100 | | minRadius | minimum radius of a metaball | Number | 3 | | maxRadius | maximum radius of a metaball | Number | 7.5 | | speed | maximum speed of a metaball | Number | 10.0 | | color | color of the metaballs | String | #ff0024 '#ff0024' | | backgroundColor | The background color of the canvas | String | #121212 '#121212' | | interactive | Create a metaball at cursor position listening to mouse move events. Valid values are window or canvas | String or Boolean | false | | useDevicePixelRatio | Use more pixels matching the device pixel ratio | Boolean | true |

Limitations

Metaballs-js currently uses uniforms to send the metaball positions to the GPU / shaders. There are specific device restrictions on the max number of uniforms, i.e., also on the max number of metaballs one can render at a time. If this happens you will see the following error thrown:

Shader compile failed with: ERROR: too many uniforms

This is especially problematic on mobile phones.

Resources

License

MIT © MrToph