@smoovy/tween
Version:
simple and easy-to-use tween lib
21 lines (20 loc) • 506 B
JavaScript
;
import { TweenController } from "../controller";
import { setDomProps } from "../dom";
function setNow(target, props, units) {
if (target instanceof HTMLElement) {
setDomProps(target, props, units);
} else {
for (const key in props) {
target[key] = props[key];
}
}
}
function set(target, props, units) {
const controller = new TweenController({
duration: 1e-3,
onStart: () => setNow(target, props, units)
});
return controller;
}
export { set, setNow };