https://github.com/pqml/raf
:movie_camera: RequestAnimationFrame utilities
https://github.com/pqml/raf
Last synced: 22 days ago
JSON representation
:movie_camera: RequestAnimationFrame utilities
- Host: GitHub
- URL: https://github.com/pqml/raf
- Owner: pqml
- License: mit
- Created: 2016-09-11T14:27:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-03-31T02:51:47.000Z (about 2 years ago)
- Last Synced: 2025-04-03T20:06:31.440Z (28 days ago)
- Language: JavaScript
- Homepage:
- Size: 169 KB
- Stars: 9
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.hbs
- License: LICENSE
Awesome Lists containing this project
README
# Raf
[:books: **Documentation**](#api) | [:tada: **Example**](https://pqml.github.io/raf) | [:globe_with_meridians: **Internet modules**](https://www.npmjs.com/org/internet)- RAF Singleton with high resolution delta time (if supported)
- Autostop & autostart requestAnimationFrame when adding/removing function
- `setBefore` & `setAfter` methods to add function at the beginning and the end of the raf call
- fps limiter
- RAF-based timer Class
# Requirements
- ES6 Modules support
- Using a module bundler like Webpack, Rollup or Parcel
- [Native support from browser](https://caniuse.com/#feat=es6-module)
- From NodeJS
- [window.requestAnimationFrame()](https://developer.mozilla.org/fr/docs/Web/API/Window/requestAnimationFrame)
# Installation
```sh
# using npm
$ npm install --save @internet/raf# or using yarn
$ yarn add @internet/raf
```
```js
import { raf, fpsLimiter, RafTimer } from '@internet/raf'
```- [:movie_camera: **raf**](#module_raf): _Raf core_
- [:hourglass_flowing_sand: **fpsLimiter**](#module_raf): _Limit function calls to a specific framerate_
- [:alarm_clock: **RafTimer**](#module_raf): _Raf-based timer class_
## :movie_camera: raf
{{#module name="raf"}}
{{>body~}}
#### API
{{>member-index~}}
{{>members~}}
{{/module}}
## :hourglass_flowing_sand: fpsLimiter
{{#globals name="fpsLimiter"}}
{{>body~}}
{{/globals}}
## :alarm_clock: RafTimer
{{#globals name="RafTimer"}}
{{>body~}}
#### API
{{>member-index~}}
{{>members~}}
{{/globals}}