@visactor/vrender-animate
Version:
This module provides a graph-based animation system for VRender.
64 lines (60 loc) • 2.67 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", {
value: !0
}), exports.GraphicStateExtension = void 0;
const animation_state_1 = require("./animation-state");
class GraphicStateExtension {
_getAnimationStateManager(graphic) {
return graphic._animationStateManager || (graphic._animationStateManager = new animation_state_1.AnimationStateManager(graphic)),
graphic._animationStateManager;
}
_getAnimationStateStore(graphic) {
return graphic._animationStateStore || (graphic._animationStateStore = new animation_state_1.AnimationStateStore(graphic)),
graphic._animationStateStore;
}
registerAnimationState(state) {
return this._getAnimationStateStore(this).registerState(state), this;
}
applyAnimationState(state, animationConfig, callback) {
return this._getAnimationStateManager(this).applyState(state, animationConfig, callback),
this;
}
applyAppearState(animationConfig, callback) {
return this._getAnimationStateManager(this).applyAppearState(animationConfig, callback),
this;
}
applyDisappearState(animationConfig, callback) {
return this._getAnimationStateManager(this).applyDisappearState(animationConfig, callback),
this;
}
applyUpdateState(animationConfig, callback) {
return this._getAnimationStateManager(this).applyUpdateState(animationConfig, callback),
this;
}
applyHighlightState(animationConfig, callback) {
return this._getAnimationStateManager(this).applyHighlightState(animationConfig, callback),
this;
}
applyUnhighlightState(animationConfig, callback) {
return this._getAnimationStateManager(this).applyUnhighlightState(animationConfig, callback),
this;
}
stopAnimationState(state, type, deep = !1) {
return this._getAnimationStateManager(this).stopState(state, type), deep && this.isContainer && this.forEachChildren((child => {
child.stopAnimationState(state, type, deep);
})), this;
}
clearAnimationStates() {
return this._getAnimationStateManager(this).clearState(), this;
}
reApplyAnimationState(state, deep = !1) {
return this._getAnimationStateManager(this).reApplyState(state), deep && this.isContainer && this.forEachChildren((child => {
child.reApplyAnimationState(state, deep);
})), this;
}
static extend(graphic) {
return (new GraphicStateExtension)._getAnimationStateManager(graphic), graphic;
}
}
exports.GraphicStateExtension = GraphicStateExtension;
//# sourceMappingURL=graphic-extension.js.map