Merge branch 'master' of github.com:airbnb/lottie-web
diff --git a/index.d.ts b/index.d.ts
index 355714b..55e316d 100644
--- a/index.d.ts
+++ b/index.d.ts
@@ -40,6 +40,7 @@
resize(): void;
setSpeed(speed: number): void;
setDirection(direction: AnimationDirection): void;
+ setLoop(isLooping: boolean): void;
playSegments(segments: AnimationSegment | AnimationSegment[], forceFlag?: boolean): void;
setSubframe(useSubFrames: boolean): void;
getDuration(inFrames?: boolean): number;
diff --git a/player/js/animation/AnimationItem.js b/player/js/animation/AnimationItem.js
index 60059d5..a299026 100644
--- a/player/js/animation/AnimationItem.js
+++ b/player/js/animation/AnimationItem.js
@@ -646,6 +646,10 @@
this.updaFrameModifier();
};
+AnimationItem.prototype.setLoop = function (isLooping) {
+ this.loop = isLooping;
+};
+
AnimationItem.prototype.setVolume = function (val, name) {
if (name && this.name !== name) {
return;
diff --git a/player/js/elements/svgElements/SVGBaseElement.js b/player/js/elements/svgElements/SVGBaseElement.js
index 93a02ba..dfda964 100644
--- a/player/js/elements/svgElements/SVGBaseElement.js
+++ b/player/js/elements/svgElements/SVGBaseElement.js
@@ -94,6 +94,12 @@
this.renderableEffectsManager = new SVGEffects(this);
},
getMatte: function (matteType) {
+ // This should not be a common case. But for backward compatibility, we'll create the matte object.
+ // It solves animations that have two consecutive layers marked as matte masks.
+ // Which is an undefined behavior in AE.
+ if (!this.matteMasks) {
+ this.matteMasks = {};
+ }
if (!this.matteMasks[matteType]) {
var id = this.layerId + '_' + matteType;
var filId;