![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
request-animation-number
Advanced tools
Light animation library for modern JavaScript.
Based on requestAnimationFrame()
method which generates smooth animation and transitions.
Matches animation speed on different screens refresh rates. Tested on 60Hz and 145Hz
Animate anything takes a value as number.
E.g. scrolling , width, color ...
Contains most popular Easing functions with the ability to provide your own.
E.g. Ease In, Ease Out, Ease In Out, .... and more
Check easings.net to learn more.
requestNum(options: object, callback: (...animatedNumbers: number[]) => void)
import { requestNum } from 'request-animation-number';
const element = document.getElementById('square');
const animationOptions = {
from: [0, 1],
to: [90, 2],
duration: 500,
easingFunction: 'easeInOutBack',
};
requestNum(animationOptions, (rotate, scale) => {
element.style.transform = `rotate(${rotate}deg) scale(${scale})`;
// ...
});
you can ether use rgb
values as an array of numbers or you can use colorToArr()
method to convert colors from string
to
array of numbers which represents rgba
values.
colorToArr()
method takes a string
and returns an array of number as [r, g, b, a]
.
colorToArr()
accept following formats: rgb(r, g, b) , rgba(r, g, b, a) , hex (e.g. "#ffffff ") , color name (e.g. "red")
import { requestNum, colorToArr } from 'request-animation-number';
const element = document.getElementById('circle');
const animationOptions = {
from: colorToArr('brown'), // returns [163, 54, 54]
to: colorToArr('#000000'), // returns [0, 0, 0]
duration: 1000,
easingFunction: 'easeInSine',
};
requestNum(animationOptions, (r, g, b) => {
element.style.backgroundColor = `rgb(${r} ${g} ${b})`;
});
requestNum()
is an asynchronous function.
You can use await
to create sequences of animation by waiting for the first animation to end then starting the next.
import { requestNum } from 'request-animation-number';
async function animate() {
const circle1 = document.getElementById('circle1');
const circle2 = document.getElementById('circle2');
await requestNum({ to: 350 }, left => (circle1.style.left = left + 'px'));
requestNum({ to: 350 }, right => (circle2.style.right = right + 'px'));
}
animate();
replay
set to -1
it will repeat infinitely.import { requestNum } from 'request-animation-number';
function animate() {
const circle1 = document.getElementById('circle1');
const circle2 = document.getElementById('circle2');
requestNum({ to: 350 }, left => {
circle1.style.left = left + 'px';
// detect when the animation ends
if (left === 350) {
requestNum({ to: 350 }, right => (circle2.style.right = right + 'px'));
// ...
}
});
}
animate();
0
by default.0 | [0, 0 , ...]
350
.0
."linear"
."linear", "easeInSine", "easeOutSine", "easeInOutSine", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeInQuint", "easeOutQuint", "easeInOutQuint", "easeInExpo", "easeOutExpo", "easeInOutExpo", "easeInCirc", "easeOutCirc", "easeInOutCirc", "easeInBack", "easeOutBack", "easeInOutBack", "easeInElastic", "easeOutElastic", "easeInOutElastic", "easeInBounce", "easeOutBounce", "easeInOutBounce"
function easeInQuad(x) {
return x * x;
}
true
.false
.duration
.delay
.-1
.0
.FAQs
Light animation library based on requestanimationframe
The npm package request-animation-number receives a total of 0 weekly downloads. As such, request-animation-number popularity was classified as not popular.
We found that request-animation-number 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.