@luceosports/play-rendering 1.11.18 → 1.11.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/layers/line/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// require all modules on the path and with the pattern defined
|
|
2
|
-
const req = require.context('./layers/', true, /.js$/);
|
|
3
|
-
|
|
4
|
-
const modules = {};
|
|
5
|
-
|
|
6
|
-
req.keys().forEach(key => {
|
|
7
|
-
const mname = key.replace('./', '').replace('.js', '');
|
|
8
|
-
modules[mname] = req(key);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
module.exports = modules;
|
|
1
|
+
// require all modules on the path and with the pattern defined
|
|
2
|
+
const req = require.context('./layers/', true, /.js$/);
|
|
3
|
+
|
|
4
|
+
const modules = {};
|
|
5
|
+
|
|
6
|
+
req.keys().forEach(key => {
|
|
7
|
+
const mname = key.replace('./', '').replace('.js', '');
|
|
8
|
+
modules[mname] = req(key);
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
module.exports = modules;
|
package/src/models/Animation.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const _ = require('lodash');
|
|
2
2
|
const config = require('../config');
|
|
3
3
|
const Frame = require('./Frame');
|
|
4
|
+
const Line = require('./Line');
|
|
4
5
|
|
|
5
6
|
class Animation {
|
|
6
7
|
constructor(ctx, play) {
|
|
@@ -50,13 +51,11 @@ class Animation {
|
|
|
50
51
|
return result;
|
|
51
52
|
}
|
|
52
53
|
|
|
53
|
-
get
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
get linePhaseIntervalMaxRounded() {
|
|
59
|
-
return this.linePhaseIntervalMax;
|
|
54
|
+
get lastLineAnimationMax() {
|
|
55
|
+
return this.play.playData.lines.reduce((result, line) => {
|
|
56
|
+
const lineModel = new Line(line);
|
|
57
|
+
return result > lineModel.lastAnimEndTime ? result : lineModel.lastAnimEndTime;
|
|
58
|
+
}, 0);
|
|
60
59
|
}
|
|
61
60
|
|
|
62
61
|
start(finishCallback, progressCallback) {
|
|
@@ -106,8 +105,8 @@ class Animation {
|
|
|
106
105
|
drawFrame(finishCallback, progressCallback, timestamp) {
|
|
107
106
|
if (!this.running) return;
|
|
108
107
|
|
|
109
|
-
if (this.globalProgress >= this.
|
|
110
|
-
progressCallback(this.
|
|
108
|
+
if (this.globalProgress >= this.lastLineAnimationMax) {
|
|
109
|
+
progressCallback(this.lastLineAnimationMax);
|
|
111
110
|
this.reset();
|
|
112
111
|
cancelAnimationFrame(this.loopId);
|
|
113
112
|
setTimeout(() => {
|