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

dots-animation

v0.2.11

Published

simple module for filling your html container with fancy responsive dots animation

Downloads

26

Readme

Dots-animation

Current features

Getting started

Install and initialize

With npm

npm install dots-animation
import { DotsAnimationFactory, IAnimationOptions, IAnimationObject } from "dots-animation";

const options = {}; // provide your options implementing 'IAnimationOptions' interface
const animationControl = DotsAnimationFactory
  .createAnimation("#container-selector", "id-for-new-canvas", options);
animationControl.start(); // 'stop' and 'pause' methods are also provided in 'IAnimationObject'

Or using CDN

<script src="https://unpkg.com/dots-animation/dist/index.umd.min.js"></script>
const factory = dotsAnim.DotsAnimationFactory;
const options = {};
const animationControl = factory
  .createAnimation("#container-selector", "id-for-new-canvas", options);
animationControl.start();

⚠️for animation to function properly its container element must have relative, absolute or fixed position!

Set your options

you can override default options by passing object with properties available in 'IAnimationOptions' interface

{
  // more fps - faster and smoother animation, highly affects performance
  // fps stability depends on client hardware
  expectedFps: 60, // positive integer  

  // number option defines maximum number of dots in canvas at the same time
  // regardless of canvas size
  // if number option is not null, density option will be ignored
  number: null, // null or positive integer, affects performance
  // density option defines maximum number of dots per canvas pixel
  density: 0.00005, // positive number, affects performance

  "dprDependentDensity": true, // use dpr in density calculation  
  "drpDependentDimensions": true, // use dpr in size and speed calculations

  // dots radius is random value between minR and MaxR
  minR: 1, // only positive values, it's desirable to use integers only for faster calculations
  maxR: 6, // only positive values, it's desirable to use integers only for faster calculations
  
  // horizontal dots speed is random value between minSpeedX and minSpeedX  
  // vertical dots speed is random value between minSpeedY and minSpeedY
  minSpeedX: -0.5, // any number, sigh defines direction of movement
  minSpeedX: 0.5, // any number, sigh defines direction of movement
  minSpeedY: -0.5, // any number, sigh defines direction of movement
  maxSpeedY: 0.5, // any number, sigh defines direction of movement
  
  blur: 1, // blur intensity in px, 0 - disabled

  fill: true, // fill dots with color
  colorsFill: ["#ffffff", "#fff4c1", "#faefdb"], // hex color strings array, color is picked randomly from color array
  opacityFill: null, // null for random opacity | from 0 to 100 where 0 means transparent
  opacityFillMin: 0, // from 0 to 100 where 0 means transparent
  opacityFillStep: 0, // from 0 to 100 where 0 means no opacity changes per frame, for creating blinking effect

  stroke: false, // circle dots with color
  colorsStroke: ["#ffffff"], // hex color strings array, color is picked randomly from color array
  opacityStroke: 1, // null for random opacity | from 0 to 100 where 0 means transparent
  opacityStrokeMin: 0, // from 0 to 100 where 0 means transparent
  opacityStrokeStep: 0, // from 0 to 100 where 0 means no opacity changes per frame, for creating blinking effect
  
  drawLines: true, // enable drawing lines between adjacent dots, most performance decreasing feature
  lineColor: "#717892", // hex color string
  lineLength: 150, // positive integer, maximum length of lines drawn between dots
  lineWidth: 2, // positive integer
  
  actionOnClick: true, // enable actions on mouse click
  actionOnHover: true, // enable actions on mouse move
  onClickCreate: false, // enable creating new dots in current mouse cursor position on click
  onClickMove: true, // enable moving adjacent dots away from mouse cursor on click
  onHoverMove: true, // enable moving adjacent dots away from mouse cursor on hover
  onHoverDrawLines: true, // enable drawing lines between mouse cursor and adjacent dots
  onClickCreateNDots: 10, // positive number, number of dots to create on mouse click
  onClickMoveRadius: 200, // positive number, minimum distance from mouse cursor to any dot after mouse click
  onHoverMoveRadius: 50, // positive number, minimum distance from mouse cursor to any dot
  onHoverLineRadius: 150 // positive number, maximum length of lines drawn between mouse cursor and adjacent dots 
}

you can find two json config examples in 'demo' folder of github repo

TODO list