
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
jw-animator
Advanced tools
A static and stateful instance which hooks into requestAnimationFrame.
A static and stateful instance which hooks into requestAnimationFrame. It uses setInterval if requestAnimationFrame is not available.
Method | Parameters | Description |
---|---|---|
setFPS | fps : integer | set a specific frame rate for the animation. |
setPauseOnHidden | hidden : boolean | set whether the animations to be paused when the page loses focus. |
setResumeOnShown | shown : boolean | set whether the animations to be resume when the page regains focus. |
start | start the animation loop. | |
pause | pause the animation loop. | |
resume | resume the animation loop. | |
stop | stop the animation loop. | |
add | handler : function | bind an event handler to the animate event. A time difference will be passed as a parameter (in seconds). Returns a method to unbind. |
onStart | handler : function | bind an event handler to the start event. Returns a method to unbind. |
onPause | handler : function | bind an event handler to the pause event. Returns a method to unbind. |
onResume | handler : function | bind an event handler to the resume event. Returns a method to unbind. |
onStop | handler : function | bind an event handler to the stop event. Returns a method to unbind. |
import Animator from "jw-animator";
/* Create an instance of an animator. */
let animator = new Animator();
/** Set a specific frame rate for the animation. */
animator.setFPS(fps);
/* Set the animations to be paused when the page loses focus. */
animator.setPauseOnHidden(pauseOnHidden);
/* Set the animations to be resume when the page regains focus. */
animator.setResumeOnShown(resumeOnShown);
/** Start the animation loop. */
animator.start();
/** Pause the animation loop. */
animator.pause();
/** Resume the animation loop. */
animator.resume();
/** Stop the animation loop. */
animator.stop();
/** Bind an event handler to the animate event. */
let remove = animator.add(timeDiff => { ... });
/** Unbind an event handler from the animate event. */
remove();
/** Bind an event handler to the start event. */
let removeStart = animator.onStart(() => { ... });
/** Unbind an event handler from the start event. */
removeStart();
/** Bind an event handler to the pause event. */
let removePause = animator.onPause(() => { ... });
/** Unbind an event handler from the pause event. */
removePause();
/** Bind an event handler to the resume event. */
let removeResume = animator.onResume(() => { ... });
/** Unbind an event handler from the resume event. */
removeResume();
/** Bind an event handler to the stop event. */
let removeStop = animator.onStop(() => { ... });
/** Unbind an event handler from the stop event. */
removeStop();
FAQs
A static and stateful instance which hooks into requestAnimationFrame.
The npm package jw-animator receives a total of 1 weekly downloads. As such, jw-animator popularity was classified as not popular.
We found that jw-animator 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.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.