@luma.gl/engine 9.0.0-beta.4 → 9.0.0-beta.6
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/dist/animation/key-frames.js +54 -54
- package/dist/animation/timeline.d.ts.map +1 -1
- package/dist/animation/timeline.js +95 -100
- package/dist/animation-loop/animation-loop-template.d.ts +1 -1
- package/dist/animation-loop/animation-loop-template.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop-template.js +19 -5
- package/dist/animation-loop/animation-loop.d.ts +2 -2
- package/dist/animation-loop/animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/animation-loop.js +433 -356
- package/dist/animation-loop/animation-props.d.ts +2 -2
- package/dist/animation-loop/animation-props.d.ts.map +1 -1
- package/dist/animation-loop/animation-props.js +0 -1
- package/dist/animation-loop/make-animation-loop.d.ts +2 -2
- package/dist/animation-loop/make-animation-loop.d.ts.map +1 -1
- package/dist/animation-loop/make-animation-loop.js +28 -24
- package/dist/debug/copy-texture-to-image.d.ts.map +1 -1
- package/dist/debug/copy-texture-to-image.js +41 -42
- package/dist/debug/debug-framebuffer.d.ts.map +1 -1
- package/dist/debug/debug-framebuffer.js +43 -40
- package/dist/debug/debug-shader-layout.js +24 -25
- package/dist/debug/pixel-data-utils.d.ts.map +1 -1
- package/dist/debug/pixel-data-utils.js +34 -36
- package/dist/dist.dev.js +3873 -8643
- package/dist/geometries/cone-geometry.d.ts +1 -1
- package/dist/geometries/cone-geometry.d.ts.map +1 -1
- package/dist/geometries/cone-geometry.js +11 -17
- package/dist/geometries/cube-geometry.d.ts +1 -1
- package/dist/geometries/cube-geometry.d.ts.map +1 -1
- package/dist/geometries/cube-geometry.js +190 -61
- package/dist/geometries/cylinder-geometry.d.ts +1 -1
- package/dist/geometries/cylinder-geometry.d.ts.map +1 -1
- package/dist/geometries/cylinder-geometry.js +9 -14
- package/dist/geometries/ico-sphere-geometry.d.ts +1 -1
- package/dist/geometries/ico-sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/ico-sphere-geometry.js +141 -160
- package/dist/geometries/plane-geometry.d.ts +1 -1
- package/dist/geometries/plane-geometry.d.ts.map +1 -1
- package/dist/geometries/plane-geometry.js +92 -110
- package/dist/geometries/sphere-geometry.d.ts +1 -1
- package/dist/geometries/sphere-geometry.d.ts.map +1 -1
- package/dist/geometries/sphere-geometry.js +76 -95
- package/dist/geometries/truncated-cone-geometry.d.ts +1 -1
- package/dist/geometries/truncated-cone-geometry.d.ts.map +1 -1
- package/dist/geometries/truncated-cone-geometry.js +99 -117
- package/dist/geometry/geometry-table.d.ts.map +1 -1
- package/dist/geometry/geometry-table.js +3 -1
- package/dist/geometry/geometry-utils.js +35 -32
- package/dist/geometry/geometry.d.ts.map +1 -1
- package/dist/geometry/geometry.js +80 -71
- package/dist/geometry/gpu-geometry.d.ts +1 -1
- package/dist/geometry/gpu-geometry.d.ts.map +1 -1
- package/dist/geometry/gpu-geometry.js +80 -99
- package/dist/geometry/gpu-table.js +41 -1
- package/dist/index.cjs +241 -206
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +41 -40
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/lib/clip-space.d.ts +1 -1
- package/dist/lib/clip-space.d.ts.map +1 -1
- package/dist/lib/clip-space.js +23 -28
- package/dist/lib/pipeline-factory.d.ts +1 -5
- package/dist/lib/pipeline-factory.d.ts.map +1 -1
- package/dist/lib/pipeline-factory.js +64 -68
- package/dist/lib/shader-factory.d.ts +17 -0
- package/dist/lib/shader-factory.d.ts.map +1 -0
- package/dist/lib/shader-factory.js +44 -0
- package/dist/model/model.d.ts +22 -10
- package/dist/model/model.d.ts.map +1 -1
- package/dist/model/model.js +562 -410
- package/dist/scenegraph/group-node.d.ts +1 -1
- package/dist/scenegraph/group-node.d.ts.map +1 -1
- package/dist/scenegraph/group-node.js +73 -83
- package/dist/scenegraph/model-node.d.ts +2 -2
- package/dist/scenegraph/model-node.d.ts.map +1 -1
- package/dist/scenegraph/model-node.js +31 -24
- package/dist/scenegraph/scenegraph-node.d.ts.map +1 -1
- package/dist/scenegraph/scenegraph-node.js +136 -124
- package/dist/shader-inputs.d.ts.map +1 -1
- package/dist/shader-inputs.js +99 -58
- package/dist/transform/buffer-transform.d.ts +1 -1
- package/dist/transform/buffer-transform.d.ts.map +1 -1
- package/dist/transform/buffer-transform.js +65 -57
- package/dist/transform/texture-transform.d.ts +1 -1
- package/dist/transform/texture-transform.d.ts.map +1 -1
- package/dist/transform/texture-transform.js +109 -114
- package/dist.min.js +2 -272
- package/package.json +10 -9
- package/src/animation/timeline.ts +20 -20
- package/src/animation-loop/animation-loop-template.ts +10 -8
- package/src/animation-loop/animation-loop.ts +20 -10
- package/src/animation-loop/animation-props.ts +1 -1
- package/src/animation-loop/make-animation-loop.ts +17 -8
- package/src/debug/copy-texture-to-image.ts +8 -6
- package/src/debug/debug-framebuffer.ts +16 -3
- package/src/debug/debug-shader-layout.ts +1 -1
- package/src/debug/pixel-data-utils.ts +3 -6
- package/src/geometries/cube-geometry.ts +17 -13
- package/src/geometries/ico-sphere-geometry.ts +1 -1
- package/src/geometries/plane-geometry.ts +1 -1
- package/src/geometries/sphere-geometry.ts +1 -1
- package/src/geometries/truncated-cone-geometry.ts +2 -1
- package/src/geometry/geometry-table.ts +9 -6
- package/src/geometry/geometry-utils.ts +1 -1
- package/src/geometry/geometry.ts +9 -6
- package/src/geometry/gpu-geometry.ts +14 -6
- package/src/index.ts +1 -0
- package/src/lib/clip-space.ts +14 -18
- package/src/lib/pipeline-factory.ts +12 -22
- package/src/lib/shader-factory.ts +55 -0
- package/src/model/model.ts +74 -42
- package/src/scenegraph/group-node.ts +14 -10
- package/src/scenegraph/model-node.ts +2 -2
- package/src/scenegraph/scenegraph-node.ts +2 -2
- package/src/shader-inputs.ts +19 -12
- package/src/transform/buffer-transform.ts +16 -8
- package/src/transform/texture-transform.ts +14 -15
- package/dist/animation/key-frames.js.map +0 -1
- package/dist/animation/timeline.js.map +0 -1
- package/dist/animation-loop/animation-loop-template.js.map +0 -1
- package/dist/animation-loop/animation-loop.js.map +0 -1
- package/dist/animation-loop/animation-props.js.map +0 -1
- package/dist/animation-loop/make-animation-loop.js.map +0 -1
- package/dist/debug/copy-texture-to-image.js.map +0 -1
- package/dist/debug/debug-framebuffer.js.map +0 -1
- package/dist/debug/debug-shader-layout.js.map +0 -1
- package/dist/debug/pixel-data-utils.js.map +0 -1
- package/dist/geometries/cone-geometry.js.map +0 -1
- package/dist/geometries/cube-geometry.js.map +0 -1
- package/dist/geometries/cylinder-geometry.js.map +0 -1
- package/dist/geometries/ico-sphere-geometry.js.map +0 -1
- package/dist/geometries/plane-geometry.js.map +0 -1
- package/dist/geometries/sphere-geometry.js.map +0 -1
- package/dist/geometries/truncated-cone-geometry.js.map +0 -1
- package/dist/geometry/geometry-table.js.map +0 -1
- package/dist/geometry/geometry-utils.js.map +0 -1
- package/dist/geometry/geometry.js.map +0 -1
- package/dist/geometry/gpu-geometry.js.map +0 -1
- package/dist/geometry/gpu-table.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/clip-space.js.map +0 -1
- package/dist/lib/pipeline-factory.js.map +0 -1
- package/dist/model/model.js.map +0 -1
- package/dist/scenegraph/group-node.js.map +0 -1
- package/dist/scenegraph/model-node.js.map +0 -1
- package/dist/scenegraph/scenegraph-node.js.map +0 -1
- package/dist/shader-inputs.js.map +0 -1
- package/dist/transform/buffer-transform.js.map +0 -1
- package/dist/transform/texture-transform.js.map +0 -1
|
@@ -1,56 +1,56 @@
|
|
|
1
|
+
/** Holds a list of key frames (timestamped values) */
|
|
1
2
|
export class KeyFrames {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
3
|
+
startIndex = -1;
|
|
4
|
+
endIndex = -1;
|
|
5
|
+
factor = 0;
|
|
6
|
+
times = [];
|
|
7
|
+
values = [];
|
|
8
|
+
_lastTime = -1;
|
|
9
|
+
constructor(keyFrames) {
|
|
10
|
+
this.setKeyFrames(keyFrames);
|
|
11
|
+
this.setTime(0);
|
|
12
|
+
}
|
|
13
|
+
setKeyFrames(keyFrames) {
|
|
14
|
+
const numKeys = keyFrames.length;
|
|
15
|
+
this.times.length = numKeys;
|
|
16
|
+
this.values.length = numKeys;
|
|
17
|
+
for (let i = 0; i < numKeys; ++i) {
|
|
18
|
+
this.times[i] = keyFrames[i][0];
|
|
19
|
+
this.values[i] = keyFrames[i][1];
|
|
20
|
+
}
|
|
21
|
+
this._calculateKeys(this._lastTime);
|
|
22
|
+
}
|
|
23
|
+
setTime(time) {
|
|
24
|
+
time = Math.max(0, time);
|
|
25
|
+
if (time !== this._lastTime) {
|
|
26
|
+
this._calculateKeys(time);
|
|
27
|
+
this._lastTime = time;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
getStartTime() {
|
|
31
|
+
return this.times[this.startIndex];
|
|
32
|
+
}
|
|
33
|
+
getEndTime() {
|
|
34
|
+
return this.times[this.endIndex];
|
|
35
|
+
}
|
|
36
|
+
getStartData() {
|
|
37
|
+
return this.values[this.startIndex];
|
|
38
|
+
}
|
|
39
|
+
getEndData() {
|
|
40
|
+
return this.values[this.endIndex];
|
|
41
|
+
}
|
|
42
|
+
_calculateKeys(time) {
|
|
43
|
+
let index = 0;
|
|
44
|
+
const numKeys = this.times.length;
|
|
45
|
+
for (index = 0; index < numKeys - 2; ++index) {
|
|
46
|
+
if (this.times[index + 1] > time) {
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
this.startIndex = index;
|
|
51
|
+
this.endIndex = index + 1;
|
|
52
|
+
const startTime = this.times[this.startIndex];
|
|
53
|
+
const endTime = this.times[this.endIndex];
|
|
54
|
+
this.factor = Math.min(Math.max(0, (time - startTime) / (endTime - startTime)), 1);
|
|
55
|
+
}
|
|
55
56
|
}
|
|
56
|
-
//# sourceMappingURL=key-frames.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../src/animation/timeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timeline.d.ts","sourceRoot":"","sources":["../../src/animation/timeline.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK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
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
rate,
|
|
24
|
-
repeat
|
|
25
|
-
};
|
|
26
|
-
this._setChannelTime(channel, this.time);
|
|
27
|
-
this.channels.set(channelId, channel);
|
|
28
|
-
return channelId;
|
|
29
|
-
}
|
|
30
|
-
removeChannel(channelId) {
|
|
31
|
-
this.channels.delete(channelId);
|
|
32
|
-
for (const [animationHandle, animation] of this.animations) {
|
|
33
|
-
if (animation.channel === channelId) {
|
|
34
|
-
this.detachAnimation(animationHandle);
|
|
35
|
-
}
|
|
7
|
+
time = 0;
|
|
8
|
+
channels = new Map();
|
|
9
|
+
animations = new Map();
|
|
10
|
+
playing = false;
|
|
11
|
+
lastEngineTime = -1;
|
|
12
|
+
constructor() { }
|
|
13
|
+
addChannel(props) {
|
|
14
|
+
const { delay = 0, duration = Number.POSITIVE_INFINITY, rate = 1, repeat = 1 } = props;
|
|
15
|
+
const channelId = channelHandles++;
|
|
16
|
+
const channel = {
|
|
17
|
+
time: 0,
|
|
18
|
+
delay,
|
|
19
|
+
duration,
|
|
20
|
+
rate,
|
|
21
|
+
repeat
|
|
22
|
+
};
|
|
23
|
+
this._setChannelTime(channel, this.time);
|
|
24
|
+
this.channels.set(channelId, channel);
|
|
25
|
+
return channelId;
|
|
36
26
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
removeChannel(channelId) {
|
|
28
|
+
this.channels.delete(channelId);
|
|
29
|
+
for (const [animationHandle, animation] of this.animations) {
|
|
30
|
+
if (animation.channel === channelId) {
|
|
31
|
+
this.detachAnimation(animationHandle);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
42
34
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
isFinished(channelId) {
|
|
36
|
+
const channel = this.channels.get(channelId);
|
|
37
|
+
if (channel === undefined) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
return this.time >= channel.delay + channel.duration * channel.repeat;
|
|
48
41
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
getTime(channelId) {
|
|
43
|
+
if (channelId === undefined) {
|
|
44
|
+
return this.time;
|
|
45
|
+
}
|
|
46
|
+
const channel = this.channels.get(channelId);
|
|
47
|
+
if (channel === undefined) {
|
|
48
|
+
return -1;
|
|
49
|
+
}
|
|
50
|
+
return channel.time;
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
52
|
+
setTime(time) {
|
|
53
|
+
this.time = Math.max(0, time);
|
|
54
|
+
const channels = this.channels.values();
|
|
55
|
+
for (const channel of channels) {
|
|
56
|
+
this._setChannelTime(channel, this.time);
|
|
57
|
+
}
|
|
58
|
+
const animations = this.animations.values();
|
|
59
|
+
for (const animationData of animations) {
|
|
60
|
+
const { animation, channel } = animationData;
|
|
61
|
+
animation.setTime(this.getTime(channel));
|
|
62
|
+
}
|
|
60
63
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
animation,
|
|
65
|
-
channel
|
|
66
|
-
} = animationData;
|
|
67
|
-
animation.setTime(this.getTime(channel));
|
|
64
|
+
play() {
|
|
65
|
+
this.playing = true;
|
|
68
66
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
pause() {
|
|
74
|
-
this.playing = false;
|
|
75
|
-
this.lastEngineTime = -1;
|
|
76
|
-
}
|
|
77
|
-
reset() {
|
|
78
|
-
this.setTime(0);
|
|
79
|
-
}
|
|
80
|
-
attachAnimation(animation, channelHandle) {
|
|
81
|
-
const animationHandle = animationHandles++;
|
|
82
|
-
this.animations.set(animationHandle, {
|
|
83
|
-
animation,
|
|
84
|
-
channel: channelHandle
|
|
85
|
-
});
|
|
86
|
-
animation.setTime(this.getTime(channelHandle));
|
|
87
|
-
return animationHandle;
|
|
88
|
-
}
|
|
89
|
-
detachAnimation(channelId) {
|
|
90
|
-
this.animations.delete(channelId);
|
|
91
|
-
}
|
|
92
|
-
update(engineTime) {
|
|
93
|
-
if (this.playing) {
|
|
94
|
-
if (this.lastEngineTime === -1) {
|
|
95
|
-
this.lastEngineTime = engineTime;
|
|
96
|
-
}
|
|
97
|
-
this.setTime(this.time + (engineTime - this.lastEngineTime));
|
|
98
|
-
this.lastEngineTime = engineTime;
|
|
67
|
+
pause() {
|
|
68
|
+
this.playing = false;
|
|
69
|
+
this.lastEngineTime = -1;
|
|
99
70
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
71
|
+
reset() {
|
|
72
|
+
this.setTime(0);
|
|
73
|
+
}
|
|
74
|
+
attachAnimation(animation, channelHandle) {
|
|
75
|
+
const animationHandle = animationHandles++;
|
|
76
|
+
this.animations.set(animationHandle, {
|
|
77
|
+
animation,
|
|
78
|
+
channel: channelHandle
|
|
79
|
+
});
|
|
80
|
+
animation.setTime(this.getTime(channelHandle));
|
|
81
|
+
return animationHandle;
|
|
82
|
+
}
|
|
83
|
+
detachAnimation(channelId) {
|
|
84
|
+
this.animations.delete(channelId);
|
|
85
|
+
}
|
|
86
|
+
update(engineTime) {
|
|
87
|
+
if (this.playing) {
|
|
88
|
+
if (this.lastEngineTime === -1) {
|
|
89
|
+
this.lastEngineTime = engineTime;
|
|
90
|
+
}
|
|
91
|
+
this.setTime(this.time + (engineTime - this.lastEngineTime));
|
|
92
|
+
this.lastEngineTime = engineTime;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
_setChannelTime(channel, time) {
|
|
96
|
+
const offsetTime = time - channel.delay;
|
|
97
|
+
const totalDuration = channel.duration * channel.repeat;
|
|
98
|
+
// Note(Tarek): Don't loop on final repeat.
|
|
99
|
+
if (offsetTime >= totalDuration) {
|
|
100
|
+
channel.time = channel.duration * channel.rate;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
channel.time = Math.max(0, offsetTime) % channel.duration;
|
|
104
|
+
channel.time *= channel.rate;
|
|
105
|
+
}
|
|
109
106
|
}
|
|
110
|
-
}
|
|
111
107
|
}
|
|
112
|
-
//# sourceMappingURL=timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation-loop-template.d.ts","sourceRoot":"","sources":["../../src/animation-loop/animation-loop-template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,
|
|
1
|
+
{"version":3,"file":"animation-loop-template.d.ts","sourceRoot":"","sources":["../../src/animation-loop/animation-loop-template.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,6BAA0B;AAEtD;;;;;;;;;;;;;;GAcG;AACH,8BAAsB,qBAAqB;gBAC7B,cAAc,CAAC,EAAE,cAAc;IACrC,YAAY,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAGpE,QAAQ,CAAC,QAAQ,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO;IAC1D,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,cAAc,GAAG,IAAI;CAC1D"}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal class that represents a "componentized" rendering life cycle
|
|
3
|
+
* (resource construction, repeated rendering, resource destruction)
|
|
4
|
+
*
|
|
5
|
+
* @note A motivation for this class compared to the raw animation loop is
|
|
6
|
+
* that it simplifies TypeScript code by allowing resources to be typed unconditionally
|
|
7
|
+
* since they are allocated in the constructor rather than in onInitialized
|
|
8
|
+
*
|
|
9
|
+
* @note Introduced in luma.gl v9
|
|
10
|
+
*
|
|
11
|
+
* @example AnimationLoopTemplate is intended to be subclassed,
|
|
12
|
+
* but the subclass should not be instantiated directly. Instead the subclass
|
|
13
|
+
* (i.e. the constructor of the subclass) should be used
|
|
14
|
+
* as an argument to create an AnimationLoop.
|
|
15
|
+
*/
|
|
1
16
|
export class AnimationLoopTemplate {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
17
|
+
constructor(animationProps) { }
|
|
18
|
+
async onInitialize(animationProps) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
6
21
|
}
|
|
7
|
-
//# sourceMappingURL=animation-loop-template.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Device } from '@luma.gl/core';
|
|
2
|
-
import { Timeline } from
|
|
3
|
-
import { AnimationProps } from
|
|
2
|
+
import { Timeline } from "../animation/timeline.js";
|
|
3
|
+
import { AnimationProps } from "./animation-props.js";
|
|
4
4
|
import { Stats, Stat } from '@probe.gl/stats';
|
|
5
5
|
/** AnimationLoop properties */
|
|
6
6
|
export type AnimationLoopProps = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation-loop.d.ts","sourceRoot":"","sources":["../../src/animation-loop/animation-loop.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"animation-loop.d.ts","sourceRoot":"","sources":["../../src/animation-loop/animation-loop.ts"],"names":[],"mappings":"AAIA,OAAO,EAAO,MAAM,EAAC,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAC,QAAQ,EAAC,iCAA8B;AAC/C,OAAO,EAAC,cAAc,EAAC,6BAA0B;AACjD,OAAO,EAAC,KAAK,EAAE,IAAI,EAAC,MAAM,iBAAiB,CAAC;AAI5C,+BAA+B;AAC/B,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEjC,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,cAAc,KAAK,MAAM,CAAC;IAC5C,YAAY,CAAC,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,OAA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