UNPKG

@visactor/vrender-animate

Version:

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

36 lines (30 loc) 1.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.AComponentAnimate = exports.ACustomAnimate = void 0; const step_1 = require("../step"); class ACustomAnimate extends step_1.Step { constructor(customFrom, customTo, duration, easing, params) { super("customAnimate", customTo, duration, easing), this.type = "customAnimate", this.customFrom = customFrom, this.params = params, this.from = customFrom, this.to = customTo; } update(end, ratio, out) { if (this.onStart(), !this.props || !this.propKeys) return; const easedRatio = this.easing(ratio); this.onUpdate(end, easedRatio, out), this.syncAttributeUpdate(); } setProps(props) { this.props = props, this.propKeys = Object.keys(props), this.animate.reSyncProps(); } } exports.ACustomAnimate = ACustomAnimate; class AComponentAnimate extends ACustomAnimate { completeBind(animator) { this.setStartTime(0), this._animator && this._animator.start(), this.setDuration(animator.getDuration()); } stop() { this._animator && this._animator.stop(); } } exports.AComponentAnimate = AComponentAnimate; //# sourceMappingURL=custom-animate.js.map