Skip to content

Commit

Permalink
version 5.8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bodymovin committed Nov 9, 2021
1 parent c79773f commit 9fd6bd4
Show file tree
Hide file tree
Showing 23 changed files with 112 additions and 52 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## V 5.8.1
- FEATURE: added more methods available for the lottie worker player

## V 5.8.0
- FEATURE: lottie player as a worker support
- FEATURE: added content-visibility prop support
Expand Down
3 changes: 3 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## V 5.8.1
- FEATURE: added more methods available for the lottie worker player

## V 5.8.0
- FEATURE: lottie player as a worker support
- FEATURE: added content-visibility prop support
Expand Down
Binary file modified build/extension/bodymovin.zxp
Binary file not shown.
7 changes: 4 additions & 3 deletions build/player/lottie.js
Original file line number Diff line number Diff line change
Expand Up @@ -13704,6 +13704,7 @@ var ExpressionManager = (function () {
var document = null;
var XMLHttpRequest = null;
var fetch = null;
var frames = null;

function $bm_isInstanceOfArray(arr) {
return arr.constructor === Array || arr.constructor === Float32Array;
Expand Down Expand Up @@ -14285,11 +14286,11 @@ var ExpressionManager = (function () {
return obKey;
}

function framesToTime(frames, fps) {
function framesToTime(fr, fps) {
if (!fps) {
fps = elem.comp.globalData.frameRate;
}
return frames / fps;
return fr / fps;
}

function timeToFrames(t, fps) {
Expand Down Expand Up @@ -16549,7 +16550,7 @@ lottie.useWebWorker = function (flag) {
};
lottie.setIDPrefix = setIDPrefix;
lottie.__getFactory = getFactory;
lottie.version = '5.8.0';
lottie.version = '5.8.1';

function checkReady() {
if (document.readyState === 'complete') {
Expand Down
2 changes: 1 addition & 1 deletion build/player/lottie.min.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions build/player/lottie_canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -11308,6 +11308,7 @@ var ExpressionManager = (function () {
var document = null;
var XMLHttpRequest = null;
var fetch = null;
var frames = null;

function $bm_isInstanceOfArray(arr) {
return arr.constructor === Array || arr.constructor === Float32Array;
Expand Down Expand Up @@ -11889,11 +11890,11 @@ var ExpressionManager = (function () {
return obKey;
}

function framesToTime(frames, fps) {
function framesToTime(fr, fps) {
if (!fps) {
fps = elem.comp.globalData.frameRate;
}
return frames / fps;
return fr / fps;
}

function timeToFrames(t, fps) {
Expand Down Expand Up @@ -14153,7 +14154,7 @@ lottie.useWebWorker = function (flag) {
};
lottie.setIDPrefix = setIDPrefix;
lottie.__getFactory = getFactory;
lottie.version = '5.8.0';
lottie.version = '5.8.1';

function checkReady() {
if (document.readyState === 'complete') {
Expand Down
2 changes: 1 addition & 1 deletion build/player/lottie_canvas.min.js

Large diffs are not rendered by default.

51 changes: 38 additions & 13 deletions build/player/lottie_canvas_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -11156,6 +11156,7 @@ var ExpressionManager = (function () {
var document = null;
var XMLHttpRequest = null;
var fetch = null;
var frames = null;

function $bm_isInstanceOfArray(arr) {
return arr.constructor === Array || arr.constructor === Float32Array;
Expand Down Expand Up @@ -11737,11 +11738,11 @@ var ExpressionManager = (function () {
return obKey;
}

function framesToTime(frames, fps) {
function framesToTime(fr, fps) {
if (!fps) {
fps = elem.comp.globalData.frameRate;
}
return frames / fps;
return fr / fps;
}

function timeToFrames(t, fps) {
Expand Down Expand Up @@ -14056,7 +14057,7 @@ GroupEffect.prototype.init = function (data, element) {
lottiejs.unmute = animationManager.unmute;
lottiejs.getRegisteredAnimations = animationManager.getRegisteredAnimations;
lottiejs.setIDPrefix = setIDPrefix;
lottiejs.version = '5.8.0';
lottiejs.version = '5.8.1';

return lottiejs;
}({}));
Expand All @@ -14074,6 +14075,10 @@ GroupEffect.prototype.init = function (data, element) {
if (animations[payload.id]) {
animations[payload.id].play();
}
} else if (type === 'stop') {
if (animations[payload.id]) {
animations[payload.id].stop();
}
} else if (type === 'setSpeed') {
if (animations[payload.id]) {
animations[payload.id].setSpeed(payload.value);
Expand Down Expand Up @@ -14136,6 +14141,10 @@ var lottie = (function () {
var workerInstance = createWorker(workerContent);
var animationIdCounter = 0;
var eventsIdCounter = 0;
var animations = {};
var defaultSettings = {
rendererSettings: {},
};

function createTree(data, container, map, afterElement) {
var elem;
Expand Down Expand Up @@ -14236,7 +14245,7 @@ var lottie = (function () {
updateElementStyles(element, elementData.styles);
updateElementAttributes(element, elementData.attributes);
}
animation.animInstance.currentTime = payload.currentTime;
animation.animInstance.currentFrame = payload.currentTime;
}
}

Expand All @@ -14260,21 +14269,29 @@ var lottie = (function () {
}
};

var animations = {};

function resolveAnimationData(params) {
return new Promise(function (resolve, reject) {
if (params.animationData) {
resolve(params);
} else if (params.path) {
fetch(params.path)
var paramsCopy = Object.assign({}, defaultSettings, params);
if (paramsCopy.animType && !paramsCopy.renderer) {
paramsCopy.renderer = paramsCopy.animType;
}
if (paramsCopy.wrapper) {
if (!paramsCopy.container) {
paramsCopy.container = paramsCopy.wrapper;
}
delete paramsCopy.wrapper;
}
if (paramsCopy.animationData) {
resolve(paramsCopy);
} else if (paramsCopy.path) {
fetch(paramsCopy.path)
.then(function (response) {
return response.json();
})
.then(function (animationData) {
params.animationData = animationData;
delete params.path;
resolve(params);
paramsCopy.animationData = animationData;
delete paramsCopy.path;
resolve(paramsCopy);
});
} else {
reject();
Expand Down Expand Up @@ -14308,6 +14325,14 @@ var lottie = (function () {
},
});
},
stop: function () {
workerInstance.postMessage({
type: 'stop',
payload: {
id: animationId,
},
});
},
setSpeed: function (value) {
workerInstance.postMessage({
type: 'setSpeed',
Expand Down
2 changes: 1 addition & 1 deletion build/player/lottie_canvas_worker.min.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions build/player/lottie_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -12350,6 +12350,7 @@ var ExpressionManager = (function () {
var document = null;
var XMLHttpRequest = null;
var fetch = null;
var frames = null;

function $bm_isInstanceOfArray(arr) {
return arr.constructor === Array || arr.constructor === Float32Array;
Expand Down Expand Up @@ -12931,11 +12932,11 @@ var ExpressionManager = (function () {
return obKey;
}

function framesToTime(frames, fps) {
function framesToTime(fr, fps) {
if (!fps) {
fps = elem.comp.globalData.frameRate;
}
return frames / fps;
return fr / fps;
}

function timeToFrames(t, fps) {
Expand Down Expand Up @@ -15195,7 +15196,7 @@ lottie.useWebWorker = function (flag) {
};
lottie.setIDPrefix = setIDPrefix;
lottie.__getFactory = getFactory;
lottie.version = '5.8.0';
lottie.version = '5.8.1';

function checkReady() {
if (document.readyState === 'complete') {
Expand Down
2 changes: 1 addition & 1 deletion build/player/lottie_html.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/player/lottie_light.js
Original file line number Diff line number Diff line change
Expand Up @@ -11145,7 +11145,7 @@ lottie.useWebWorker = function (flag) {
};
lottie.setIDPrefix = setIDPrefix;
lottie.__getFactory = getFactory;
lottie.version = '5.8.0';
lottie.version = '5.8.1';

function checkReady() {
if (document.readyState === 'complete') {
Expand Down
2 changes: 1 addition & 1 deletion build/player/lottie_light.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/player/lottie_light_canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -11321,7 +11321,7 @@ lottie.useWebWorker = function (flag) {
};
lottie.setIDPrefix = setIDPrefix;
lottie.__getFactory = getFactory;
lottie.version = '5.8.0';
lottie.version = '5.8.1';

function checkReady() {
if (document.readyState === 'complete') {
Expand Down
2 changes: 1 addition & 1 deletion build/player/lottie_light_canvas.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/player/lottie_light_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -12315,7 +12315,7 @@ lottie.useWebWorker = function (flag) {
};
lottie.setIDPrefix = setIDPrefix;
lottie.__getFactory = getFactory;
lottie.version = '5.8.0';
lottie.version = '5.8.1';

function checkReady() {
if (document.readyState === 'complete') {
Expand Down
2 changes: 1 addition & 1 deletion build/player/lottie_light_html.min.js

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions build/player/lottie_svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -11180,6 +11180,7 @@ var ExpressionManager = (function () {
var document = null;
var XMLHttpRequest = null;
var fetch = null;
var frames = null;

function $bm_isInstanceOfArray(arr) {
return arr.constructor === Array || arr.constructor === Float32Array;
Expand Down Expand Up @@ -11761,11 +11762,11 @@ var ExpressionManager = (function () {
return obKey;
}

function framesToTime(frames, fps) {
function framesToTime(fr, fps) {
if (!fps) {
fps = elem.comp.globalData.frameRate;
}
return frames / fps;
return fr / fps;
}

function timeToFrames(t, fps) {
Expand Down Expand Up @@ -14025,7 +14026,7 @@ lottie.useWebWorker = function (flag) {
};
lottie.setIDPrefix = setIDPrefix;
lottie.__getFactory = getFactory;
lottie.version = '5.8.0';
lottie.version = '5.8.1';

function checkReady() {
if (document.readyState === 'complete') {
Expand Down
2 changes: 1 addition & 1 deletion build/player/lottie_svg.min.js

Large diffs are not rendered by default.

51 changes: 38 additions & 13 deletions build/player/lottie_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -12387,6 +12387,7 @@ var ExpressionManager = (function () {
var document = null;
var XMLHttpRequest = null;
var fetch = null;
var frames = null;

function $bm_isInstanceOfArray(arr) {
return arr.constructor === Array || arr.constructor === Float32Array;
Expand Down Expand Up @@ -12968,11 +12969,11 @@ var ExpressionManager = (function () {
return obKey;
}

function framesToTime(frames, fps) {
function framesToTime(fr, fps) {
if (!fps) {
fps = elem.comp.globalData.frameRate;
}
return frames / fps;
return fr / fps;
}

function timeToFrames(t, fps) {
Expand Down Expand Up @@ -15287,7 +15288,7 @@ GroupEffect.prototype.init = function (data, element) {
lottiejs.unmute = animationManager.unmute;
lottiejs.getRegisteredAnimations = animationManager.getRegisteredAnimations;
lottiejs.setIDPrefix = setIDPrefix;
lottiejs.version = '5.8.0';
lottiejs.version = '5.8.1';

return lottiejs;
}({}));
Expand All @@ -15305,6 +15306,10 @@ GroupEffect.prototype.init = function (data, element) {
if (animations[payload.id]) {
animations[payload.id].play();
}
} else if (type === 'stop') {
if (animations[payload.id]) {
animations[payload.id].stop();
}
} else if (type === 'setSpeed') {
if (animations[payload.id]) {
animations[payload.id].setSpeed(payload.value);
Expand Down Expand Up @@ -15367,6 +15372,10 @@ var lottie = (function () {
var workerInstance = createWorker(workerContent);
var animationIdCounter = 0;
var eventsIdCounter = 0;
var animations = {};
var defaultSettings = {
rendererSettings: {},
};

function createTree(data, container, map, afterElement) {
var elem;
Expand Down Expand Up @@ -15467,7 +15476,7 @@ var lottie = (function () {
updateElementStyles(element, elementData.styles);
updateElementAttributes(element, elementData.attributes);
}
animation.animInstance.currentTime = payload.currentTime;
animation.animInstance.currentFrame = payload.currentTime;
}
}

Expand All @@ -15491,21 +15500,29 @@ var lottie = (function () {
}
};

var animations = {};

function resolveAnimationData(params) {
return new Promise(function (resolve, reject) {
if (params.animationData) {
resolve(params);
} else if (params.path) {
fetch(params.path)
var paramsCopy = Object.assign({}, defaultSettings, params);
if (paramsCopy.animType && !paramsCopy.renderer) {
paramsCopy.renderer = paramsCopy.animType;
}
if (paramsCopy.wrapper) {
if (!paramsCopy.container) {
paramsCopy.container = paramsCopy.wrapper;
}
delete paramsCopy.wrapper;
}
if (paramsCopy.animationData) {
resolve(paramsCopy);
} else if (paramsCopy.path) {
fetch(paramsCopy.path)
.then(function (response) {
return response.json();
})
.then(function (animationData) {
params.animationData = animationData;
delete params.path;
resolve(params);
paramsCopy.animationData = animationData;
delete paramsCopy.path;
resolve(paramsCopy);
});
} else {
reject();
Expand Down Expand Up @@ -15539,6 +15556,14 @@ var lottie = (function () {
},
});
},
stop: function () {
workerInstance.postMessage({
type: 'stop',
payload: {
id: animationId,
},
});
},
setSpeed: function (value) {
workerInstance.postMessage({
type: 'setSpeed',
Expand Down
Loading

0 comments on commit 9fd6bd4

Please sign in to comment.