@visactor/vrender-animate
Version:
This module provides a graph-based animation system for VRender.
34 lines (30 loc) • 1.51 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.Update = void 0;
const custom_animate_1 = require("./custom-animate");
class Update extends custom_animate_1.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);
}
}
exports.Update = Update;
//# sourceMappingURL=update.js.map