UNPKG

lottie-web

Version:

After Effects plugin for exporting animations to SVG + JavaScript or canvas + JavaScript

41 lines (34 loc) 1.14 kB
import TextProperty from '../text/TextProperty'; import ExpressionManager from './ExpressionManager'; function addDecorator() { function searchExpressions() { if (this.data.d.x) { this.calculateExpression = ExpressionManager.initiateExpression.bind(this)(this.elem, this.data.d, this); this.addEffect(this.getExpressionValue.bind(this)); return true; } return null; } TextProperty.prototype.getExpressionValue = function (currentValue, text) { var newValue = this.calculateExpression(text); if (currentValue.t !== newValue) { var newData = {}; this.copyData(newData, currentValue); newData.t = newValue.toString(); newData.__complete = false; return newData; } return currentValue; }; TextProperty.prototype.searchProperty = function () { var isKeyframed = this.searchKeyframes(); var hasExpressions = this.searchExpressions(); this.kf = isKeyframed || hasExpressions; return this.kf; }; TextProperty.prototype.searchExpressions = searchExpressions; } function initialize() { addDecorator(); } export default initialize;