
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
TinyAnimate
Advanced tools
Animation microlib. Vanilla JavaScript. Uses `requestAnimationFrame()` if available, falls back to `setTimeout()`.
Animation micro library. Vanilla JavaScript, includes a global and UMD. Minified to only 3.8kb. Uses requestAnimationFrame()
if available, falls back to setTimeout()
.
Supports all the easings you can find on easings.net, and custom easing functions.
var square = document.querySelector('.square');
TinyAnimate.animateCSS(square, 'marginLeft', 'px', 10, 70, 500, 'easeInOutQuart', function() {
console.log('done!!!111oneone');
});
var square = document.querySelector('.square');
TinyAnimate.animate(70, 10, 1000, function(x) {
square.setAttribute('x', x);
});
define(['TinyAnimate'], function(TinyAnimate) {
var elem = document.querySelector('button.send');
elem.addEventListener('click', function(e) {
TinyAnimate.animate(1, .5, 500, function(opacity) {
square.style.backgroundColor = 'rgba(65, 131, 196, ' + opacity + ')';
});
});
});
TinyAnimate.animate(from, to, duration, update, easing, done)
from
(int) — Property value to animate fromto
(int) — Property value to animate toduration
(int) — Duration in millisecondsupdate
(function) — Function to implement updating the DOM, get's called with a value between from
and to
easing
(string | function) — Optional: A string when the easing function is available in TinyAnimate.easings
, or a function with the signature: function(t, b, c, d) {...}
done
(function) — Optional: To be executed when the animation has completed.TinyAnimate.animateCSS(element, property, unit, from, to, duration, easing, done)
element
(HTMLElement) — A dom nodeproperty
(string) — Property name, as available in element.style, i.e. 'borderRadius', not 'border-radius'unit
(string) — Property unit, like 'px'from
(int) — Property value to animate fromto
(int) — Property value to animate toduration
(int) — Duration in millisecondseasing
(string | function) — Optional: A string when the easing function is available in TinyAnimate.easings
, or a function with the signature: function(t, b, c, d) {...}
done
(function) — Optional: To be executed when the animation has completed.TinyAnimate.cancel(animation)
animation
(object) - Animation object returned from animate
or animateCSS
.All the easings found at easings.net are supported. I suggest you strip out all the easings you do not use in production to keep the bytes down. If you don't specify an easing, or specify an incorrect easing, the default linear easing will be used.
It's also possible to specify the easing as a function. Read more about creating easing functions manually here and here.
It uses the unprefixed version of requestAnimationFrame
, if available. You can however include a polyfill as well, if
you need to support more browsers. See caniuse.com/requestanimationframe for
more detailed browser support, everthing that needs a prefix will only use requestAnimationFrame
whenever a polyfill
has been included. If window.requestAnimationFrame
is not found, setTimeout()
will be used.
A polyfill for requestAnimationFrame
is included in the project, but you are not required to use it. Choose wisely.
Released under the MIT license.
FAQs
Animation microlib. Vanilla JavaScript. Uses `requestAnimationFrame()` if available, falls back to `setTimeout()`.
The npm package TinyAnimate receives a total of 151 weekly downloads. As such, TinyAnimate popularity was classified as not popular.
We found that TinyAnimate 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
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.