bomsy / d-lite

A small js library that simulates digital lighting.

Home Page:http://bomsy.github.com/d-lite

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dlite.js

A small js library that simulates digital lighting. Dependent on d3.js library. The character library currently contains all uppercase, lowercase characters, digits and some special characters such as *, -, _, ?, ., /, =, +, !.

Compatibility

Compatible with ie9+, chrome, firefox, safari, opera

Dependencies

This library is dependent on the D3 Visualization library.

Getting Started

Creating a simple lighting to display "Hello World"

Dlite("foo")
    .setContent("HELLO WORLD")
    .setSize(5)
    .setColor("#f00")
    .setAlignment(Dlite.align.HORIZONTAL)
    .setBackground(Dlite.background.SHOW)
    .show()

See more in the Code examples

Dlite

methods

  • setContent([string]/[numbers]/[array]) : Sets the content to be displayed. Content can be a string, series of digits, an array (basic array or passed through the Dlite.waveform.domain generated function. See code examples)

  • setSize(size) : Sets the size of each lighting element. It takes a number as parameter (Note: no units).

  • setColor(color) : Sets the color for the lighting. it takes color strings, HEX or RGB values.

  • setAlignment(alignment) : Sets the alignment of the charaters in the content. The constants accepted by the alignment are either Dlite.align.HORIZONTAL or Dlite.align.VERTICAL .

  • setBackground(state) : Sets the state of the background. The 3 possible states are Dlite.background.SHOW , Dlite.background.PARTIAL or Dlite.background.NONE .

  • show(delay, interval, duration, callback) : Starts the lighting. if no arguments is passed, it runs once (to display its currrent content). It also accepts 4 arguments in which situation it runs according to the parameters specifications. See code examples

  • Dlite.waveforms.domain(lowerlimit, upperlimit) : Allows for generating waveforms using random data. it takes in integer values for the lower and upper limits of the domain, then returns a function which is used to scale the waveform array. See code examples above for more details.

properties

  • version : Specifies the current version.

constants

  • Dlite.align.HORIZONTAL : When used, elements will be aligned horizontally.

  • Dlite.align.VERTICAL : When used, elements will be aligned vertically.

  • Dlite.background.SHOW : When used, the full background will be shown.

  • Dlite.background.PARTIAL : When used, an outline of background will be shown.

  • Dlite.background.NONE : When used, no background will be shown.

Authors

This library is developed by Hubert Boma Manilla.

Licence

Copyright (c) 2012 Hubert Boma Manilla

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A small js library that simulates digital lighting.

http://bomsy.github.com/d-lite


Languages

Language:JavaScript 100.0%