https://github.com/dy/fps-indicator
Tiny fps indicator for demo or tests
https://github.com/dy/fps-indicator
Last synced: about 1 year ago
JSON representation
Tiny fps indicator for demo or tests
- Host: GitHub
- URL: https://github.com/dy/fps-indicator
- Owner: dy
- Created: 2016-08-14T23:05:54.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-25T23:25:34.000Z (over 7 years ago)
- Last Synced: 2025-05-12T06:07:47.444Z (about 1 year ago)
- Language: JavaScript
- Homepage: https://dy.github.io/fps-indicator/
- Size: 17.6 KB
- Stars: 31
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# fps-indicator [](http://github.com/badges/stability-badges)
Micro fps indicator for demo/tests.
[](http://dy.github.io/fps-indicator/)
## Usage
[](https://npmjs.org/package/fps-indicator/)
```js
const createFps = require('fps-indicator');
let fps = createFps();
```
## API
### var fps = createFps(container|options?)
Create fps indicator from `position` string or `options` object:
| Option | Description |
|---|---|
| `container` | Selector or element to append, by default `document.body`. |
| `period` | Update period in ms, defaults to `500`. |
| `max` | Max value of FPS, corresponding to upper bound, default is `90`. |
| `color` | Color of indicator, by default is inherited. |
| `position` | `top-left`, `top-right`, `bottom-left` (default), `bottom-right`. |
| `style` | CSS style string or [css object](https://npmjs.org/package/to-css). Eg. `fps({style: 'padding: 20px; text-shadow: 0 0 2px black'})` |
## Similar
> [stats.js](https://www.npmjs.com/package/stats.js) — oldschool fps meter for apps, no colors customization.
> [fpsmeter](http://darsa.in/fpsmeter/) — good-looking fps meter, but no npm package.