animatable-js
Version:
This package allows easy and light implementation of linear or curved animation in javascript. (Especially suitable in a development environment on web components or canvas.)
10 lines (9 loc) • 339 B
JavaScript
import { Animation, Curve } from "../dist/index.esm.js";
const text = document.getElementById("text");
const box = document.getElementById("box");
const animation = new Animation(1000, Curve.Ease);
animation.addListener(value => {
box.style.width = `${value * 100}%`;
text.textContent = value;
});
animation.repeat(1, 0);