"use strict"; exports.__esModule = true; exports.fadeIn = fadeIn; var _common = require("../util/common"); var _util = require("./util"); /** * Animation functions for shape * @author sima.zhang1990@gmail.com */ /* function waveIn(shape, animateCfg, coord) { const clip = Helpers.getClip(coord); clip.set('canvas', shape.get('canvas')); shape.attr('clip', clip); const onEnd = function() { shape.attr('clip', null); clip.remove(true); }; Helpers.doAnimation(clip, clip.endState, animateCfg, onEnd); } function scaleInX(shape, animateCfg) { const box = shape.getBBox(); const points = shape.get('origin').points; let x; const y = (box.minY + box.maxY) / 2; if (points[0].y - points[1].y > 0) { // 当顶点在零点之下 x = box.maxX; } else { x = box.minX; } const scaledMatrix = Helpers.getScaledMatrix(shape, [ x, y ], 'x'); Helpers.doAnimation(shape, { matrix: scaledMatrix }, animateCfg); } function scaleInY(shape, animateCfg) { const box = shape.getBBox(); const points = shape.get('origin').points; const x = (box.minX + box.maxX) / 2; let y; if (points[0].y - points[1].y <= 0) { // 当顶点在零点之下 y = box.maxY; } else { y = box.minY; } const scaledMatrix = Helpers.getScaledMatrix(shape, [ x, y ], 'x'); Helpers.doAnimation(shape, { matrix: scaledMatrix }, animateCfg); } */ function fadeIn(shape, animateCfg) { var fillOpacity = (0, _common.isNil)(shape.attr('fillOpacity')) ? 1 : shape.attr('fillOpacity'); var strokeOpacity = (0, _common.isNil)(shape.attr('strokeOpacity')) ? 1 : shape.attr('strokeOpacity'); shape.attr('fillOpacity', 0); shape.attr('strokeOpacity', 0); var endState = { fillOpacity: fillOpacity, strokeOpacity: strokeOpacity }; (0, _util.doAnimation)(shape, endState, animateCfg); }