UNPKG

@visactor/vrender-animate

Version:

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

109 lines (103 loc) 3.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.PoptipDisappear = exports.PoptipAppear = void 0; const custom_animate_1 = require("./custom-animate"), component_1 = require("../component"), input_text_1 = require("./input-text"); class PoptipAppear extends custom_animate_1.AComponentAnimate { onBind() { super.onBind(); const animator = (0, component_1.createComponentAnimator)(this.target); this._animator = animator; const duration = this.duration, easing = this.easing, target = this.target, {wave: wave} = this.params; if (target.setAttributes({ scaleX: 0, scaleY: 0 }), animator.animate(target, { type: "to", to: { scaleX: 1, scaleY: 1 }, duration: duration / 3 * 2, easing: easing }), target.titleShape && animator.animate(target.titleShape, { type: "custom", to: { text: target.titleShape.attribute.text }, duration: duration, easing: easing, custom: input_text_1.InputText }), target.contentShape && animator.animate(target.contentShape, { type: "custom", to: { text: target.contentShape.attribute.text }, duration: duration, easing: easing, custom: input_text_1.InputText }), wave) { const dur = duration / 6; animator.animate(target.group, { timeSlices: [ { duration: dur, effects: { type: "to", to: { angle: wave }, easing: easing } }, { duration: 2 * dur, effects: { type: "to", to: { angle: -wave }, easing: easing } }, { duration: 2 * dur, effects: { type: "to", to: { angle: wave }, easing: easing } }, { duration: dur, effects: { type: "to", to: { angle: 0 }, easing: easing } } ] }); } this.completeBind(animator); } } exports.PoptipAppear = PoptipAppear; class PoptipDisappear extends custom_animate_1.AComponentAnimate { onBind() { super.onBind(); const animator = (0, component_1.createComponentAnimator)(this.target); this._animator = animator; const duration = this.duration, easing = this.easing, target = this.target; animator.animate(target, { type: "to", to: { scaleX: 0, scaleY: 0 }, duration: duration, easing: easing }), this.completeBind(animator); } } exports.PoptipDisappear = PoptipDisappear; //# sourceMappingURL=poptip-animate.js.map