diff --git a/lib/intval/index.js b/lib/intval/index.js index bc69ef3..20e7459 100644 --- a/lib/intval/index.js +++ b/lib/intval/index.js @@ -243,12 +243,15 @@ intval.setDir = function (val = true) { return log.warn('Direction must be represented as either true or false') } intval._state.dir = val + log.info('setDir', { direction : dir ? 'forward' : 'backward' }) } intval.setTime = function (val = 0) { intval._state.frame.time = val + log.info('setTime', { time : val }) } intval.setDelay = function (val = 0) { intval._state.frame.delay = val + log.info('setDelay', { delay : val }) } /** * Begin a single frame with set variables or defaults @@ -284,9 +287,9 @@ intval.frame = function (dir = null, time = null) { if (time !== null && time !== 0) { setTimeout(intval._pause, intval._state.frame.open) if (dir) { - setTimeout(intval._startFwd, 1000) + setTimeout(intval._startFwd, (time - intval._state.frame.open)) } else { - setTimeout(intval._startBwd, 1000) + setTimeout(intval._startBwd, (time - intval._state.frame.open)) } } } diff --git a/tests/index.js b/tests/index.js index f03fef0..d956129 100644 --- a/tests/index.js +++ b/tests/index.js @@ -4,4 +4,4 @@ const intval = require('../lib/intval') intval.init() -intval.setTime(1000) \ No newline at end of file +intval.setTime(5000) \ No newline at end of file