0.1.1 • Published 9 years ago

lucy-util v0.1.1

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

Lucy util Build Status

Part of Lucidity project.

Utility functions and helper classes.

Installation

Currently only works with io.js.

npm install lucy-util --save

util.elapsed()

Returns elapsed time since application start in secondes.

const util = require ( 'lucy-util' )

console.log ( util.elapsed () )

util.Continuous

When a value is regularly updated by an external source (midi sync, osc messages, etc) the value 'jumps' every time. This transforms a discrete value change to a continuous, smooth value. The most important option is the 'stiffness'. With a value of '1', the jitter in setting value is not smoothed out. With lower values, the returned value is smoothed.

const util = require ( 'lucy-util' )
let foo = new util.Continuous ( 0.8 ) // smooth follower

// external (example midi sync)
foo.setValue ( 1.0, util.elapsed () - deltaTime / 1000 )

// read
console.log ( 'foo is now', foo.value () )

// or, to have the same timestamp used for different values
console.log ('foo is now', foo.value ( someApp.now ) )

Tests

 npm test

Contributing

Please use 'jessy style'.

Add unit tests for any new or changed functionality.

Release History

  • 0.1.1 (2015-09-02) Fixed main index file.
  • 0.1.0 (2015-09-02) Initial release.