Push dev work to master #2

Merged
sixteenmillimeter merged 416 commits from dev into master 2018-07-19 15:29:02 +00:00
2 changed files with 6 additions and 3 deletions
Showing only changes of commit 43213cc6ce - Show all commits

View File

@ -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))
}
}
}

View File

@ -4,4 +4,4 @@ const intval = require('../lib/intval')
intval.init()
intval.setTime(1000)
intval.setTime(5000)