Socket
Book a DemoInstallSign in
Socket

nayuki-canvas

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

nayuki-canvas

A floating node HTML5 canvas

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

Nayuki Canvas

Build Status Dependency Status codecov

Nayuki Canvas a floating node HTML5 canvas with zero dependencies and lovably simple setup.

Screenshot software

Install

$ npm install nayuki-canvas --save

Setup (as global)

<script src="./path/to/node_modules/nayuki-canvas/dist/nayuki-canvas.min.js">

Also consumable as Javascript Module and AMD

Usage

var canvas = document.getElementById('canvas');
var config = {};
var myCanvas = nayukiCanvas(canvas, config).start();

API

Configuration Options

NameTypeDefaultDescription
extraEdgesNumber20Recommendation on how many edges should appear
nodeCountNumber70Amount of nodes to render
networkString'balanced'Other network styles: mesh & wheel
repulsionNumber1Speed at which nodes move from one another
borderFadeNumber-0.02Place where nodes fade on canvas edge
fadeInRateNumber0.06Rate of nodes fade on create
fadeOutRateNumber0.03Rate of nodes fade on destroy
frameIntervalNumber20Speed of canvas
backgroundArray/String['#0275d8', '#055396']String and array HEX values
gradientString'radial'Gradient styles: linear, radial
nodeColorString'#f1f1f1'HEX value of node color
edgeColorString'#b4b4b4'HEX value of edge color
edgeSizeNumber0.7Thickness of edge
nodeSizeNumber900Size of node

Starting & Stopping

myCanvasInstance.start(); // Start Canvas
myCanvasInstance.stop(); // Freeze Frame™

Updating

myCanvasInstance.nodeSize = 450;
// On next frame render nodes will have new size

Removing

myCanvasInstance.destroy();

Checking Browser Support

if (nayukiCanvas.isSupported) {
  // canvas time
}

Manual Frame Rendering

myCanvasInstance.start().stop(); // queue and cancel frame render
myCanvasInstance.next(); // manually draw next frame

Created by

Matt JensenNayuki
Matt JensenNayuki

Version

  • Version 0.0.1

License

Keywords

HTML5

FAQs

Package last updated on 13 Jul 2016

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