UNPKG

@visactor/vrender-animate

Version:

This module provides a graph-based animation system for VRender.

26 lines (25 loc) 1.36 kB
import { ACustomAnimate } from "./custom-animate"; export class Update extends ACustomAnimate { constructor(from, to, duration, easing, params) { super(from, to, duration, easing, params); } onBind() { var _a, _b; super.onBind(); let {diffAttrs: diffAttrs = {}} = null !== (_a = this.target.context) && void 0 !== _a ? _a : {}; const {options: options} = this.params; diffAttrs = Object.assign({}, diffAttrs), (null === (_b = null == options ? void 0 : options.excludeChannels) || void 0 === _b ? void 0 : _b.length) && options.excludeChannels.forEach((channel => { delete diffAttrs[channel]; })), this.props = diffAttrs; } update(end, ratio, out) { if (this.onStart(), !this.props || !this.propKeys) return; const easedRatio = this.easing(ratio); this.animate.interpolateUpdateFunction ? this.animate.interpolateUpdateFunction(this.fromProps, this.props, easedRatio, this, this.target) : this.interpolateUpdateFunctions.forEach(((func, index) => { if (!this.animate.validAttr(this.propKeys[index])) return; const key = this.propKeys[index]; func(key, this.fromProps[key], this.props[key], easedRatio, this, this.target); })), this.onUpdate(end, easedRatio, out); } } //# sourceMappingURL=update.js.map