normalize-time
This is a normalizer for time-based stuff. The module is a function that takes 4 arguments:
- start time
- duration
- min
- max
min and max are optional, and wil default to 0 and 1 respectively.
It returns a function that takes a single param, time
npm install normalize-time
usage
var tnorm = ;var time = ;var duration = 3000; var normalize = forvar t = time; t < time + duration console; t = ;
What we have done here is created a function that will normalize 3 seconds of time to values between zero and one. We could have passed min and max values to normalize between any two values.
You may find this useful with such modules as jsynth
test
wow johnny wrote a test. to run the tests:
npm install tape
node test.js