Javascript variable chaser
npm install chaserbash
npm install --save chaser
`
Usage
`javascript
const chaser = require('chaser')
const myAnimatedVar = chaser(12) // 12 is our initial value here
myAnimateVar.target = 20
setInterval(() => {
console.log(myAnimatedVar.value) // You can use .value anywhere and it will be generated accurately by timing function and passed time.
}, 10)
`
Chaser using React Hooks with
useChaser
`javascript
import { useChaser } from 'chaser'
function MovingBox() {
const [posX, setPosX] = useChaser(0 / initialValue /)
return (
translateX(${posX}px) }}>
)
}
``