0.4.3 • Published 4 years ago

chaser v0.4.3

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

Chaser

chaser

JavaScript variable chaser

Installation

npm install --save chaser

Usage

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

import { useChaser } from 'chaser'

function MovingBox() {
    const [posX, setPosX] = useChaser(0 /* initialValue */)

    return (
        <div style={{ transform: `translateX(${posX}px)` }}>
            <button onClick={() => setPosX(Math.random() * 100)} />
        </div>
    )
}

Example

If you're looking for an example, here's a unclean example! but works: https://alireza29675.github.io/chaser/

Contribute

Put issues! Suggest me what you need.

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.0

5 years ago