
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
Ridiculously small animation library. Less than 260 bytes. Fits in a tweet.
npm install nm8 --save<script src="https://unpkg.com/nm8"></script>
import nm8 from 'nm8';
const output = value => console.log(value);
// create animation
const animation = nm8(output, 1000);
// play animation
animation.play();
// pause animation
animation.pause();
// stop animation
animation.stop();
nm8(onTick: (value: number) => void, duration?: number)Creates an animation that calls onTick with the current:
offset (between 0 and 1) if duration is specifieddelta (in ms) if no duration is specified. Usually 16 or 17.animation.play()Starts playing the animation, because the animation doesn't just fire off immediately. That's irresponsible.
animation.pause()Pauses the animation. The onTick handler won't be called again until .play() or .stop() is called.
animation.stop()Stops the animation. The onTick handler will be called with the end value (either 1 if duration is specified or Infinity otherwise). Calling .play() on a stopped animation will restart it.
How do I actually make stuff move?
const ball = document.querySelector('#ball');
const animation = nm8(offset => {
// moves ball from 0 to 1000px over 1 second
ball.style.transform = `translateX(${offset * 1000}px)`
}, 1000).play();
What about easing?
// use sine easing, it's really nice
const easeSine = fn => offset => fn((1 - Math.cos(offset * Math.PI)) / 2);
const animation = nm8(easeSine(offset => {
ball.style.transform = `translateX(${offset * 1000}px)`
}), 1000).play();
What about delays?
// just copy-paste this. it's math
const delayNm8 = (fn, duration, delay) => nm8(delayOffset => {
const offset = Math.max(delayOffset - delay / (duration + delay), 0) * (duration + delay) / duration;
fn(offset);
}, duration + delay);
// 1-second ease animation with 2-second delay
const animation = delayNm8(easeSine(offset => {
ball.style.transform = `translateX(${offset * 1000}px)`
}), 1000, 2000).play();
I want more easing functions.
Here's a bunch: https://github.com/just-animate/just-curves
Can I request a feature?
No. Use https://github.com/tweenrex/tweenrex if you want a small tweening library with more features.
What is the browser support?
Just avoid IE, okay?
Why is it so small?
So you can copy-paste it:
function nm8(a,b){let c,d,e,f=(g)=>{let h=+!c||-(d||g)+(d=g);a(b?Math.min(Math.max((e+=h)/b,0),1):h);return!c||e>=b||requestAnimationFrame(f)},g={play:()=>(c=1,b&&e<=b||(e=0),f(performance.now()),g),pause:()=>(c=0,g),stop:()=>(e=d=c=0,g)};return g}
Have examples? Check out the examples directory: https://github.com/davidkpiano/nm8/blob/master/examples
FAQs
Ridiculously small animation library. Less than 260 bytes. Fits in a tweet.
The npm package nm8 receives a total of 0 weekly downloads. As such, nm8 popularity was classified as not popular.
We found that nm8 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
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.