Merge branch 'master' of github.com:airbnb/lottie-web
diff --git a/index.d.ts b/index.d.ts
index 52a16e0..7ea3621 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -36,7 +36,7 @@
viewBoxSize?: string;
};
-export type CanavasRendererConfig = BaseRendererConfig & {
+export type CanvasRendererConfig = BaseRendererConfig & {
clearCanvas?: boolean;
context?: CanvasRenderingContext2D;
progressiveLoad?: boolean;
@@ -53,7 +53,7 @@
loop?: boolean | number;
autoplay?: boolean;
name?: string;
- rendererSettings?: SVGRendererConfig | CanavasRendererConfig | HTMLRendererConfig;
+ rendererSettings?: SVGRendererConfig | CanvasRendererConfig | HTMLRendererConfig;
}
export type AnimationConfigWithPath = AnimationConfig & {
diff --git a/player/js/elements/htmlElements/HTextElement.js b/player/js/elements/htmlElements/HTextElement.js
index 552ca88..ec60168 100644
--- a/player/js/elements/htmlElements/HTextElement.js
+++ b/player/js/elements/htmlElements/HTextElement.js
@@ -81,6 +81,7 @@
} else {
tParent = createTag('div');
+ tParent.style.lineHeight = 0;
tCont = createNS('svg');
tCont.appendChild(tSpan);
styleDiv(tParent);
diff --git a/player/js/mask.js b/player/js/mask.js
index a7d694a..7100a3a 100644
--- a/player/js/mask.js
+++ b/player/js/mask.js
@@ -19,8 +19,7 @@
var rect, expansor, feMorph,x;
var maskType = 'clipPath', maskRef = 'clip-path';
for (i = 0; i < len; i++) {
-
- if((properties[i].mode !== 'a' && properties[i].mode !== 'n')|| properties[i].inv || properties[i].o.k !== 100){
+ if((properties[i].mode !== 'a' && properties[i].mode !== 'n')|| properties[i].inv || properties[i].o.k !== 100 || properties[i].o.x){
maskType = 'mask';
maskRef = 'mask';
}
diff --git a/player/js/utils/FontManager.js b/player/js/utils/FontManager.js
index ff49056..80b0dca 100644
--- a/player/js/utils/FontManager.js
+++ b/player/js/utils/FontManager.js
@@ -220,11 +220,12 @@
var i = 0, len = this.chars.length;
while( i < len) {
if(this.chars[i].ch === char && this.chars[i].style === style && this.chars[i].fFamily === font){
+
return this.chars[i];
}
i+= 1;
}
- if(console && console.warn) {
+ if((typeof char === 'string' && char.charCodeAt(0) !== 13 || !char) && console && console.warn) {
console.warn('Missing character from exported characters list: ', char, style, font);
}
return emptyChar;
diff --git a/player/js/utils/expressions/CompInterface.js b/player/js/utils/expressions/CompInterface.js
index 0a2f2ae..99121e0 100644
--- a/player/js/utils/expressions/CompInterface.js
+++ b/player/js/utils/expressions/CompInterface.js
@@ -1,9 +1,9 @@
-var CompExpressionInterface = (function (){
- return function(comp){
- function _thisLayerFunction(name){
- var i=0, len = comp.layers.length;
- while(i<len){
- if(comp.layers[i].nm === name || comp.layers[i].ind === name){
+var CompExpressionInterface = (function () {
+ return function(comp) {
+ function _thisLayerFunction(name) {
+ var i = 0, len = comp.layers.length;
+ while ( i < len) {
+ if (comp.layers[i].nm === name || comp.layers[i].ind === name) {
return comp.elements[i].layerInterface;
}
i += 1;
@@ -11,13 +11,13 @@
return null;
//return {active:false};
}
- Object.defineProperty(_thisLayerFunction, "_name", { value:comp.data.nm });
+ Object.defineProperty(_thisLayerFunction, "_name", { value: comp.data.nm });
_thisLayerFunction.layer = _thisLayerFunction;
_thisLayerFunction.pixelAspect = 1;
_thisLayerFunction.height = comp.data.h || comp.globalData.compSize.h;
_thisLayerFunction.width = comp.data.w || comp.globalData.compSize.w;
_thisLayerFunction.pixelAspect = 1;
- _thisLayerFunction.frameDuration = 1/comp.globalData.frameRate;
+ _thisLayerFunction.frameDuration = 1 / comp.globalData.frameRate;
_thisLayerFunction.displayStartTime = 0;
_thisLayerFunction.numLayers = comp.layers.length;
return _thisLayerFunction;
diff --git a/player/js/utils/expressions/ExpressionManager.js b/player/js/utils/expressions/ExpressionManager.js
index 29d3b63..67cd011 100644
--- a/player/js/utils/expressions/ExpressionManager.js
+++ b/player/js/utils/expressions/ExpressionManager.js
@@ -362,7 +362,7 @@
var height = elem.data.sh ? elem.data.sh : 0;
var name = elem.data.nm;
var loopIn, loop_in, loopOut, loop_out, smooth;
- var toWorld,fromWorld,fromComp,toComp,fromCompToSurface, position, rotation, anchorPoint, scale, thisLayer,thisComp,mask,valueAtTime,velocityAtTime;
+ var toWorld,fromWorld,fromComp,toComp,fromCompToSurface, position, rotation, anchorPoint, scale, thisLayer, thisComp,mask,valueAtTime,velocityAtTime;
var __expression_functions = [];
if(data.xf) {
var i, len = data.xf.length;
diff --git a/player/js/utils/expressions/MaskInterface.js b/player/js/utils/expressions/MaskInterface.js
index fafeaaf..477c021 100644
--- a/player/js/utils/expressions/MaskInterface.js
+++ b/player/js/utils/expressions/MaskInterface.js
@@ -6,12 +6,20 @@
}
Object.defineProperty(MaskInterface.prototype, 'maskPath', {
get: function(){
- if(this._mask.prop.k){
- this._mask.prop.getValue();
- }
- return this._mask.prop;
+ if(this._mask.prop.k){
+ this._mask.prop.getValue();
}
- });
+ return this._mask.prop;
+ }
+ });
+ Object.defineProperty(MaskInterface.prototype, 'maskOpacity', {
+ get: function(){
+ if(this._mask.op.k){
+ this._mask.op.getValue();
+ }
+ return this._mask.op.v * 100;
+ }
+ });
var MaskManager = function(maskManager, elem){
var _maskManager = maskManager;
diff --git a/player/js/utils/text/TextProperty.js b/player/js/utils/text/TextProperty.js
index 69befe2..16bc6e8 100644
--- a/player/js/utils/text/TextProperty.js
+++ b/player/js/utils/text/TextProperty.js
@@ -197,9 +197,9 @@
}
documentData.fWeight = fontData.fWeight || fWeight;
documentData.fStyle = fStyle;
- len = documentData.t.length;
documentData.finalSize = documentData.s;
documentData.finalText = this.buildFinalText(documentData.t);
+ len = documentData.finalText.length;
documentData.finalLineHeight = documentData.lh;
var trackingOffset = documentData.tr/1000*documentData.finalSize;
var charCode;