
Security News
Socket Security Analysis Is Now One Click Away on npm
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.
A tiny (178B) helper for playing, pausing, and setting requestAnimationFrame frame rates
A tiny (178B) helper for playing, pausing, and setting
requestAnimationFrameframe rates.
This module is delivered as:
dist/rafps.mjsdist/rafps.jsdist/rafps.min.js$ npm install --save rafps
import rafps from 'rafps';
// Run at 30fps
const ctx = rafps(frame => {
console.log('Current frame:', frame);
// Do animation things...
// target hit, pause animation
// .. or can run indefinitely
if (frame >= 1e3) ctx.pause();
}, 30);
// Begin playback
ctx.play();
Returns: RAFPS
Returns a new RAFPS instance which can toggle between play/pause states using the same draw and fps values.
Type: Function
Required: true
The callback function you want invoked at every "frame" tick.
It will receive one argument, frame (number), which is the current frame count since playback began.
The frame count starts at 0 and will increment indefinitely until paused. Once paused, frame will start from 0 once again.
Type: Number
Default: 60
The number of frames per second* to shoot for.
Put differently, this is the maximum number of times draw will be called per second.
Important: This is a time-based calculation, so it's a best guess solution!
Also, your true framerate will be at the mercy of yourdrawcallback.
You should aim for lightweight operations that complete within1ms.
Returns: void
Begin playback.
Your draw function will begin invocations, receiving a new frame (number) parameter. See draw for info.
Returns: void
Pause playback.
MIT © Luke Edwards
FAQs
A tiny (178B) helper for playing, pausing, and setting requestAnimationFrame frame rates
The npm package rafps receives a total of 2 weekly downloads. As such, rafps popularity was classified as not popular.
We found that rafps demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.