0.0.4 • Published 9 years ago

led-canvas-led v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

led-canvas-led

NPM version Build Status Coverage Status Dependency Status devDependency Status

Example LED class to be used by https://github.com/marionebl/led-canvas.

Example

var Led = require('led-canvas-led');

/**
 * Creates an instance of led-canvas-led with coordinates { x: 1, y: 1 }
 * and a size of 10 and with
 * @type {Led}
 */
var led = new Led(1, 1, 10)

Minimal interface

Led.constructor

/**
 * Construct a new instance of Led
 * @param  {Integer} x - x coordinate of the new Led
 * @param  {Integer} y - y coordinate of the new Led
 * @param  {Integer} size - diameter in px of the new Led
 * @param {Boolean} enabled - enabled/disabled state of the new Led
 * @return {Led} new Led instance
 */

Led.toggle

/**
 * Toggles the led's state
 * @param {Boolean} [flag] Forced target state flag
 * @return {Led} Current instance of Led
 */

Led.set

/**
 * Sets a style property
 * @param {String} key - Name of the style property to set
 * @param {String} vale - Value to assign to the property with name [key]
 * @return {Led} Current instance of Led
 */

Led.render

/**
 * Renders the led on the given RenderingContext
 * @param {CanvasRenderingContext2D} context - Rendering context to paint on
 */