UNPKG

@smoovy/tween

Version:
21 lines (20 loc) 506 B
"use strict"; 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 };