https://github.com/alireza29675/chaser
😼 JavaScript variable chaser
https://github.com/alireza29675/chaser
chaser easing transition
Last synced: 11 months ago
JSON representation
😼 JavaScript variable chaser
- Host: GitHub
- URL: https://github.com/alireza29675/chaser
- Owner: Alireza29675
- License: mit
- Created: 2019-06-27T11:18:41.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-10T20:23:32.000Z (about 3 years ago)
- Last Synced: 2024-08-09T10:03:55.894Z (over 1 year ago)
- Topics: chaser, easing, transition
- Language: TypeScript
- Homepage: https://alireza29675.github.io/chaser/
- Size: 3.21 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Chaser

JavaScript variable chaser
## Installation
```bash
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 (
setPosX(Math.random() * 100)} />
)
}
```
## Example
If you're looking for an example, here's a unclean example! but works:
[https://alireza29675.github.io/chaser/](https://alireza29675.github.io/chaser/)
## Contribute
Put issues! Suggest me what you need.