Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

canvas-lightning

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-lightning

Canvas lightning generator

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Canvas lightning app

Canvas lightning generator.

See the example.

Installation

Run command: npm i canvas-lightning

Usage

import canvasLightning from 'canvas-lightning';

const canvasEl = document.querySelector('canvas');

const app = canvasLightning(canvasEl, {
  WIDTH: 100,
  HEIGHT: 200
});

app.start();

window.addEventListener('resize', start);

/* Cleanup*/
app.stop();

Configuration

{
  /* Minimal deviation from center */
  MIN_X: 1,

  /* Maximum deviation from center */
  MAX_X: 10,

  /* Minimum step down */
  MIN_Y: 2,

  /* Maximum step down */
  MAX_Y: 10,

  /* Refresh interval. */
  LOOP_INTERVAL: 100,

  /* Thickness of the lightning. */
  LINE_WIDTH: 3,

  /* Blur surrounding the line. */
  LINE_BLUR: 10,

  /* How are the curves rounded? */
  LINE_JOIN: 'miter',

  /* Color of the lightning */
  COLOR_LIGHT: '#fff',

  /* Color of the surrounding blur. */
  COLOR_BLUR: '#0ff',

  /* Background color.  */
  COLOR_BG: 'transparent',

  /* How many images should be cached.
   * After filing in the cache, no more renders will be done,
   * but existing snapshots will be used. */
  CACHE_COUNT: 10,

  /* Size of the canvas to be set. */
  WIDTH: 2,
  HEIGHT: 2
}

FAQs

Package last updated on 18 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc