@needle-tools/engine 4.10.0-next.f0ec242 → 4.10.0
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/CHANGELOG.md +7 -3
- package/README.md +2 -1
- package/components.needle.json +1 -1
- package/dist/needle-engine.bundle-BSq-d_16.min.js +1652 -0
- package/dist/{needle-engine.bundle-dgNq9Vsa.umd.cjs → needle-engine.bundle-C2kVfQq6.umd.cjs} +153 -140
- package/dist/{needle-engine.bundle-BC-0Ex9m.js → needle-engine.bundle-CIuhf7-t.js} +7388 -7113
- package/dist/needle-engine.d.ts +15 -15
- package/dist/needle-engine.js +259 -257
- package/dist/needle-engine.min.js +1 -1
- package/dist/needle-engine.umd.cjs +1 -1
- package/dist/vendor-CPuBPspY.umd.cjs +1121 -0
- package/dist/vendor-DPCU8cUF.min.js +1121 -0
- package/dist/vendor-MBoqSyFm.js +16240 -0
- package/lib/engine/codegen/register_types.js +2 -0
- package/lib/engine/codegen/register_types.js.map +1 -1
- package/lib/engine/engine_camera.d.ts +7 -1
- package/lib/engine/engine_camera.js +46 -6
- package/lib/engine/engine_camera.js.map +1 -1
- package/lib/engine/engine_context.d.ts +6 -0
- package/lib/engine/engine_context.js +48 -9
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_gizmos.d.ts +11 -10
- package/lib/engine/engine_gizmos.js +24 -10
- package/lib/engine/engine_gizmos.js.map +1 -1
- package/lib/engine/engine_license.js +1 -1
- package/lib/engine/engine_license.js.map +1 -1
- package/lib/engine/engine_lightdata.d.ts +3 -3
- package/lib/engine/engine_lightdata.js +10 -10
- package/lib/engine/engine_lightdata.js.map +1 -1
- package/lib/engine/engine_physics_rapier.js +4 -0
- package/lib/engine/engine_physics_rapier.js.map +1 -1
- package/lib/engine/engine_scenelighting.d.ts +1 -1
- package/lib/engine/engine_scenelighting.js +4 -5
- package/lib/engine/engine_scenelighting.js.map +1 -1
- package/lib/engine/engine_utils.d.ts +3 -1
- package/lib/engine/engine_utils.js +11 -0
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_lightmaps.js +1 -1
- package/lib/engine/extensions/NEEDLE_lightmaps.js.map +1 -1
- package/lib/engine/extensions/extension_utils.js +1 -1
- package/lib/engine/extensions/extension_utils.js.map +1 -1
- package/lib/engine/webcomponents/logo-element.d.ts +1 -1
- package/lib/engine/webcomponents/logo-element.js +29 -5
- package/lib/engine/webcomponents/logo-element.js.map +1 -1
- package/lib/engine/webcomponents/needle menu/needle-menu.js +4 -3
- package/lib/engine/webcomponents/needle menu/needle-menu.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.js +22 -0
- package/lib/engine/webcomponents/needle-engine.js.map +1 -1
- package/lib/engine/webcomponents/needle-engine.loading.d.ts +0 -1
- package/lib/engine/webcomponents/needle-engine.loading.js +3 -36
- package/lib/engine/webcomponents/needle-engine.loading.js.map +1 -1
- package/lib/engine/xr/NeedleXRController.d.ts +3 -3
- package/lib/engine/xr/NeedleXRController.js +28 -0
- package/lib/engine/xr/NeedleXRController.js.map +1 -1
- package/lib/engine-components/CameraUtils.js +2 -1
- package/lib/engine-components/CameraUtils.js.map +1 -1
- package/lib/engine-components/Renderer.js +6 -1
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/Skybox.js +22 -4
- package/lib/engine-components/Skybox.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +1 -0
- package/lib/engine-components/codegen/components.js +1 -0
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/lib/engine-components/debug/LogStats.d.ts +1 -0
- package/lib/engine-components/debug/LogStats.js +1 -0
- package/lib/engine-components/debug/LogStats.js.map +1 -1
- package/lib/engine-components/timeline/PlayableDirector.d.ts +7 -0
- package/lib/engine-components/timeline/PlayableDirector.js +8 -1
- package/lib/engine-components/timeline/PlayableDirector.js.map +1 -1
- package/lib/engine-components/timeline/TimelineModels.d.ts +11 -1
- package/lib/engine-components/timeline/TimelineTracks.d.ts +2 -1
- package/lib/engine-components/timeline/TimelineTracks.js +30 -25
- package/lib/engine-components/timeline/TimelineTracks.js.map +1 -1
- package/lib/engine-components/utils/LookAt.js +5 -1
- package/lib/engine-components/utils/LookAt.js.map +1 -1
- package/lib/engine-components/web/Clickthrough.js +10 -2
- package/lib/engine-components/web/Clickthrough.js.map +1 -1
- package/lib/engine-components/web/ScrollFollow.d.ts +24 -0
- package/lib/engine-components/web/ScrollFollow.js +169 -42
- package/lib/engine-components/web/ScrollFollow.js.map +1 -1
- package/lib/engine-components/web/ViewBox.d.ts +43 -0
- package/lib/engine-components/web/ViewBox.js +258 -0
- package/lib/engine-components/web/ViewBox.js.map +1 -0
- package/lib/engine-components/web/index.d.ts +1 -0
- package/lib/engine-components/web/index.js +1 -0
- package/lib/engine-components/web/index.js.map +1 -1
- package/lib/engine-components-experimental/Presentation.d.ts +1 -0
- package/lib/engine-components-experimental/Presentation.js +1 -0
- package/lib/engine-components-experimental/Presentation.js.map +1 -1
- package/package.json +3 -2
- package/src/engine/codegen/register_types.ts +2 -0
- package/src/engine/engine_camera.ts +61 -9
- package/src/engine/engine_context.ts +50 -10
- package/src/engine/engine_gizmos.ts +37 -23
- package/src/engine/engine_license.ts +1 -1
- package/src/engine/engine_lightdata.ts +11 -11
- package/src/engine/engine_physics_rapier.ts +3 -0
- package/src/engine/engine_scenelighting.ts +5 -6
- package/src/engine/engine_utils.ts +12 -0
- package/src/engine/extensions/NEEDLE_lightmaps.ts +1 -1
- package/src/engine/extensions/extension_utils.ts +1 -1
- package/src/engine/webcomponents/logo-element.ts +29 -4
- package/src/engine/webcomponents/needle menu/needle-menu.ts +4 -3
- package/src/engine/webcomponents/needle-engine.loading.ts +32 -32
- package/src/engine/webcomponents/needle-engine.ts +33 -6
- package/src/engine/xr/NeedleXRController.ts +36 -4
- package/src/engine-components/CameraUtils.ts +1 -1
- package/src/engine-components/Renderer.ts +6 -1
- package/src/engine-components/Skybox.ts +26 -7
- package/src/engine-components/codegen/components.ts +1 -0
- package/src/engine-components/debug/LogStats.ts +1 -0
- package/src/engine-components/timeline/PlayableDirector.ts +10 -1
- package/src/engine-components/timeline/TimelineModels.ts +11 -1
- package/src/engine-components/timeline/TimelineTracks.ts +30 -25
- package/src/engine-components/utils/LookAt.ts +5 -1
- package/src/engine-components/web/Clickthrough.ts +11 -2
- package/src/engine-components/web/ScrollFollow.ts +205 -51
- package/src/engine-components/web/ViewBox.ts +278 -0
- package/src/engine-components/web/index.ts +2 -1
- package/src/engine-components-experimental/Presentation.ts +1 -0
- package/dist/needle-engine.bundle-BSh7dSEx.min.js +0 -1639
- package/dist/vendor-D0Yvltn9.umd.cjs +0 -1121
- package/dist/vendor-DU8tJyl_.js +0 -14366
- package/dist/vendor-JyrX4DVM.min.js +0 -1121
|
@@ -4,7 +4,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
+
// For firefox ViewTimeline support
|
|
8
|
+
import "scroll-timeline-polyfill/dist/scroll-timeline.js";
|
|
7
9
|
import { Object3D } from "three";
|
|
10
|
+
import { isDevEnvironment } from "../../engine/debug/debug.js";
|
|
8
11
|
import { Mathf } from "../../engine/engine_math.js";
|
|
9
12
|
import { serializable } from "../../engine/engine_serialization.js";
|
|
10
13
|
import { getBoundingBox } from "../../engine/engine_three_utils.js";
|
|
@@ -26,6 +29,7 @@ const debug = getParam("debugscroll");
|
|
|
26
29
|
*
|
|
27
30
|
* @link Example at https://scrollytelling-2-z23hmxby7c6x-u30ld.needle.run/
|
|
28
31
|
* @link Template at https://github.com/needle-engine/scrollytelling-template
|
|
32
|
+
* @link [Scrollytelling Bike Demo](https://scrollytelling-bike-z23hmxb2gnu5a.needle.run/)
|
|
29
33
|
*
|
|
30
34
|
* ## How to use with an Animator
|
|
31
35
|
* 1. Create an Animator component and set up a float parameter named "scroll".
|
|
@@ -116,7 +120,8 @@ export class ScrollFollow extends Behaviour {
|
|
|
116
120
|
this._current_value = this._target_value;
|
|
117
121
|
}
|
|
118
122
|
}
|
|
119
|
-
if (this._current_value !== this._appliedValue)
|
|
123
|
+
// if (this._current_value !== this._appliedValue)
|
|
124
|
+
{
|
|
120
125
|
this._appliedValue = this._current_value;
|
|
121
126
|
let defaultPrevented = false;
|
|
122
127
|
if (this.changed.listenerCount > 0) {
|
|
@@ -134,8 +139,8 @@ export class ScrollFollow extends Behaviour {
|
|
|
134
139
|
// if not prevented apply scroll
|
|
135
140
|
if (!defaultPrevented) {
|
|
136
141
|
const value = this.invert ? 1 - this._current_value : this._current_value;
|
|
137
|
-
const height = this._rangeEndValue - this._rangeStartValue;
|
|
138
|
-
const pixelValue = this._rangeStartValue + value * height;
|
|
142
|
+
// const height = this._rangeEndValue - this._rangeStartValue;
|
|
143
|
+
// const pixelValue = this._rangeStartValue + value * height;
|
|
139
144
|
// apply scroll to target(s)
|
|
140
145
|
if (Array.isArray(this.target)) {
|
|
141
146
|
this.target.forEach(t => t && this.applyScroll(t, value));
|
|
@@ -144,7 +149,7 @@ export class ScrollFollow extends Behaviour {
|
|
|
144
149
|
this.applyScroll(this.target, value);
|
|
145
150
|
}
|
|
146
151
|
if (debug && this.context.time.frame % 30 === 0) {
|
|
147
|
-
console.debug(`[ScrollFollow] ${this._current_value.toFixed(5)} — ${(this._target_value * 100).toFixed(0)}
|
|
152
|
+
console.debug(`[ScrollFollow] ${this._current_value.toFixed(5)} — ${(this._target_value * 100).toFixed(0)}%, targets [${Array.isArray(this.target) ? this.target.length : 1}]`);
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
155
|
}
|
|
@@ -194,8 +199,9 @@ export class ScrollFollow extends Behaviour {
|
|
|
194
199
|
return;
|
|
195
200
|
if (target instanceof PlayableDirector) {
|
|
196
201
|
this.handleTimelineTarget(target, value);
|
|
197
|
-
if (
|
|
198
|
-
target.
|
|
202
|
+
if (target.isPlaying)
|
|
203
|
+
target.pause();
|
|
204
|
+
target.evaluate();
|
|
199
205
|
}
|
|
200
206
|
else if (target instanceof Animator) {
|
|
201
207
|
target.setFloat("scroll", value);
|
|
@@ -239,18 +245,36 @@ export class ScrollFollow extends Behaviour {
|
|
|
239
245
|
let scrollRegionStart = Infinity;
|
|
240
246
|
let scrollRegionEnd = 0;
|
|
241
247
|
markersArray.length = 0;
|
|
248
|
+
// querySelectorResults.length = 0;
|
|
249
|
+
let markerIndex = 0;
|
|
250
|
+
// https://scroll-driven-animations.style/tools/view-timeline/ranges
|
|
242
251
|
for (const marker of director.foreachMarker("ScrollMarker")) {
|
|
252
|
+
const index = markerIndex++;
|
|
243
253
|
// Get marker elements from DOM
|
|
244
|
-
if (
|
|
254
|
+
if ((marker.element === undefined || marker.needsUpdate === true || /** element is not in DOM anymore? */ (marker.element && !marker.element?.parentNode))) {
|
|
245
255
|
marker.needsUpdate = false;
|
|
246
256
|
try {
|
|
247
|
-
|
|
257
|
+
// TODO: with this it's currently not possible to remap markers from HTML. For example if I have two sections and I want to now use the marker["center"] multiple times to stay at that marker for a longer time
|
|
258
|
+
marker.element = tryGetElementsForSelector(index, marker.name);
|
|
248
259
|
if (debug)
|
|
249
|
-
console.debug(
|
|
260
|
+
console.debug(`ScrollMarker #${index} "${marker.name}" (${marker.time.toFixed(2)}) found`, marker.element);
|
|
261
|
+
if (!marker.element) {
|
|
262
|
+
marker.timeline = undefined;
|
|
263
|
+
if (debug || isDevEnvironment())
|
|
264
|
+
console.warn(`No HTML element found for ScrollMarker: ${marker.name} (index ${index})`);
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
/** @ts-ignore */
|
|
269
|
+
marker.timeline = new ViewTimeline({
|
|
270
|
+
subject: marker.element,
|
|
271
|
+
axis: 'block', // https://drafts.csswg.org/scroll-animations/#scroll-notation
|
|
272
|
+
});
|
|
273
|
+
}
|
|
250
274
|
}
|
|
251
275
|
catch (error) {
|
|
252
276
|
marker.element = null;
|
|
253
|
-
console.error("ScrollMarker selector is not valid: " + marker.
|
|
277
|
+
console.error("ScrollMarker selector is not valid: " + marker.name + "\n", error);
|
|
254
278
|
}
|
|
255
279
|
}
|
|
256
280
|
// skip markers without element (e.g. if the selector didn't return any element)
|
|
@@ -271,48 +295,92 @@ export class ScrollFollow extends Behaviour {
|
|
|
271
295
|
const currentBottom = currentTop + this._scrollContainerHeight;
|
|
272
296
|
weightsArray.length = 0;
|
|
273
297
|
let sum = 0;
|
|
298
|
+
const oneFrameTime = 1 / 60;
|
|
299
|
+
// We keep a separate count here in case there are some markers that could not be resolved so point to *invalid* elements - the timeline should fallback to 0-1 scroll behaviour then
|
|
274
300
|
let markerCount = 0;
|
|
275
|
-
for (
|
|
301
|
+
for (let i = 0; i < markersArray.length; i++) {
|
|
302
|
+
const marker = markersArray[i];
|
|
276
303
|
if (!marker.element)
|
|
277
304
|
continue;
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
305
|
+
const nextMarker = markersArray[i + 1];
|
|
306
|
+
const nextTime = nextMarker
|
|
307
|
+
? (nextMarker.time - oneFrameTime)
|
|
308
|
+
: duration;
|
|
309
|
+
markerCount += 1;
|
|
310
|
+
const timeline = marker.timeline;
|
|
311
|
+
if (timeline) {
|
|
312
|
+
const time01 = calculateTimelinePositionNormalized(timeline);
|
|
313
|
+
// remap 0-1 to 0 - 1 - 0 (full weight at center)
|
|
314
|
+
const weight = 1 - Math.abs(time01 - 0.5) * 2;
|
|
315
|
+
const name = marker.name || `marker${i}`;
|
|
316
|
+
if (time01 > 0 && time01 <= 1) {
|
|
317
|
+
const lerpTime = marker.time + (nextTime - marker.time) * time01;
|
|
318
|
+
weightsArray.push({ name, time: lerpTime, weight: weight });
|
|
319
|
+
sum += weight;
|
|
320
|
+
}
|
|
321
|
+
// Before the first marker is reached
|
|
322
|
+
else if (i === 0 && time01 <= 0) {
|
|
323
|
+
weightsArray.push({ name, time: 0, weight: 1 });
|
|
324
|
+
sum += 1;
|
|
325
|
+
}
|
|
326
|
+
// After the last marker is reached
|
|
327
|
+
else if (i === markersArray.length - 1 && time01 >= 1) {
|
|
328
|
+
weightsArray.push({ name, time: duration, weight: 1 });
|
|
329
|
+
sum += 1;
|
|
330
|
+
}
|
|
301
331
|
}
|
|
332
|
+
continue;
|
|
333
|
+
// if(this.context.time.frame % 10 === 0) console.log(marker.element?.className, timeline, calculateTimelinePositionNormalized(timeline!));
|
|
334
|
+
// const top = marker.element.offsetTop - this._scrollContainerHeight;
|
|
335
|
+
// const height = marker.element.offsetHeight + this._scrollContainerHeight;
|
|
336
|
+
// const bottom = top + height;
|
|
337
|
+
// let overlap = 0;
|
|
338
|
+
// // TODO: if we have two marker sections where no HTML overlaps (vor example because some large section is between them) we probably want to still virtually interpolate between them slowly in that region
|
|
339
|
+
// if (bottom < currentTop) {
|
|
340
|
+
// // marker is above scroll region
|
|
341
|
+
// overlap = 0;
|
|
342
|
+
// }
|
|
343
|
+
// else if (top > currentBottom) {
|
|
344
|
+
// // marker is below scroll region
|
|
345
|
+
// overlap = 0;
|
|
346
|
+
// }
|
|
347
|
+
// else {
|
|
348
|
+
// // calculate overlap in pixels
|
|
349
|
+
// const overlapTop = Math.max(top, currentTop);
|
|
350
|
+
// const overlapBottom = Math.min(bottom, currentBottom);
|
|
351
|
+
// const height = Math.max(1, currentBottom - currentTop);
|
|
352
|
+
// overlap = Math.max(0, overlapBottom - overlapTop);
|
|
353
|
+
// }
|
|
354
|
+
// // if(this.context.time.frame % 20 === 0) console.log(overlap)
|
|
355
|
+
// if (overlap > 0) {
|
|
356
|
+
// weightsArray.push({ time: marker.time, weight: overlap });
|
|
357
|
+
// sum += overlap;
|
|
358
|
+
// }
|
|
302
359
|
}
|
|
303
|
-
if (weightsArray.length <= 0 &&
|
|
360
|
+
if (weightsArray.length <= 0 && markerCount <= 0) {
|
|
304
361
|
director.time = value * duration;
|
|
305
362
|
}
|
|
306
363
|
else if (weightsArray.length > 0) {
|
|
307
364
|
// normalize and calculate weighted time
|
|
308
|
-
let time = weightsArray[0].time;
|
|
309
|
-
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
365
|
+
let time = weightsArray[0].time; // fallback to first time
|
|
366
|
+
if (weightsArray.length > 1) {
|
|
367
|
+
for (const entry of weightsArray) {
|
|
368
|
+
const weight = entry.weight / Math.max(0.00001, sum);
|
|
369
|
+
// console.log(weight.toFixed(2))
|
|
370
|
+
// lerp time based on weight
|
|
371
|
+
const diff = Math.abs(entry.time - time);
|
|
372
|
+
time += diff * weight;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if (this.damping <= 0) {
|
|
376
|
+
director.time = time;
|
|
377
|
+
}
|
|
378
|
+
else {
|
|
379
|
+
director.time = Mathf.lerp(director.time, time, this.context.time.deltaTime / this.damping);
|
|
380
|
+
}
|
|
381
|
+
if (debug && this.context.time.frame % 30 === 0) {
|
|
382
|
+
console.log(`[ScrollFollow ] Timeline ${director.name}: ${time.toFixed(3)}`, weightsArray.map(w => `[${w.name} ${(w.weight * 100).toFixed(0)}%]`).join(", "));
|
|
314
383
|
}
|
|
315
|
-
director.time = time;
|
|
316
384
|
}
|
|
317
385
|
}
|
|
318
386
|
}
|
|
@@ -336,4 +404,63 @@ __decorate([
|
|
|
336
404
|
], ScrollFollow.prototype, "changed", void 0);
|
|
337
405
|
const weightsArray = [];
|
|
338
406
|
const markersArray = [];
|
|
407
|
+
// type SelectorCache = {
|
|
408
|
+
// /** The selector used to query the *elements */
|
|
409
|
+
// selector: string,
|
|
410
|
+
// elements: Element[] | null,
|
|
411
|
+
// usedElementCount: number,
|
|
412
|
+
// }
|
|
413
|
+
// const querySelectorResults: Array<SelectorCache> = [];
|
|
414
|
+
const needleScrollMarkerIndexCache = new Map();
|
|
415
|
+
const needleScrollMarkerNameCache = new Map();
|
|
416
|
+
let needsScrollMarkerRefresh = true;
|
|
417
|
+
function tryGetElementsForSelector(index, name, _cycle = 0) {
|
|
418
|
+
if (!needsScrollMarkerRefresh) {
|
|
419
|
+
if (name?.length) {
|
|
420
|
+
const element = needleScrollMarkerNameCache.get(name) || null;
|
|
421
|
+
if (element)
|
|
422
|
+
return element;
|
|
423
|
+
// const isNumber = !isNaN(Number(name));
|
|
424
|
+
// if (!isNumber) {
|
|
425
|
+
// }
|
|
426
|
+
}
|
|
427
|
+
const element = needleScrollMarkerIndexCache.get(index) || null;
|
|
428
|
+
const value = element?.getAttribute("data-timeline-marker");
|
|
429
|
+
// if (value?.length) {
|
|
430
|
+
// if (cycle === 0) {
|
|
431
|
+
// // if the HTML marker we found by index does define a different marker name we try to find the correct HTML element by name
|
|
432
|
+
// return tryGetElementsForSelector(index, value, 1);
|
|
433
|
+
// }
|
|
434
|
+
// if (isDevEnvironment()) console.warn(`ScrollMarker name mismatch: expected "${name}", got "${value}"`);
|
|
435
|
+
// }
|
|
436
|
+
return element;
|
|
437
|
+
}
|
|
438
|
+
needsScrollMarkerRefresh = false;
|
|
439
|
+
needleScrollMarkerIndexCache.clear();
|
|
440
|
+
const markers = document.querySelectorAll(`[data-timeline-marker]`);
|
|
441
|
+
markers.forEach((m, i) => {
|
|
442
|
+
needleScrollMarkerIndexCache.set(i, m);
|
|
443
|
+
const name = m.getAttribute("data-timeline-marker");
|
|
444
|
+
if (name?.length)
|
|
445
|
+
needleScrollMarkerNameCache.set(name, m);
|
|
446
|
+
});
|
|
447
|
+
needsScrollMarkerRefresh = false;
|
|
448
|
+
return tryGetElementsForSelector(index, name);
|
|
449
|
+
}
|
|
450
|
+
// #region ScrollTimeline
|
|
451
|
+
function calculateTimelinePositionNormalized(timeline) {
|
|
452
|
+
if (!timeline.source)
|
|
453
|
+
return 0;
|
|
454
|
+
const currentTime = timeline.currentTime;
|
|
455
|
+
const duration = timeline.duration;
|
|
456
|
+
let durationValue = 1;
|
|
457
|
+
if (duration.unit === "seconds") {
|
|
458
|
+
durationValue = duration.value;
|
|
459
|
+
}
|
|
460
|
+
else if (duration.unit === "percent") {
|
|
461
|
+
durationValue = duration.value;
|
|
462
|
+
}
|
|
463
|
+
const t01 = currentTime.unit === "seconds" ? (currentTime.value / durationValue) : (currentTime.value / 100);
|
|
464
|
+
return t01;
|
|
465
|
+
}
|
|
339
466
|
//# sourceMappingURL=ScrollFollow.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScrollFollow.js","sourceRoot":"","sources":["../../../src/engine-components/web/ScrollFollow.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,OAAO,CAAC;AAIvC,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,E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|
1
|
+
import { Behaviour } from "../Component.js";
|
|
2
|
+
/**
|
|
3
|
+
* This component can be used to automatically fit a certain box area into the camera view - no matter your screen size or aspect ratio.
|
|
4
|
+
*
|
|
5
|
+
* Add the ViewBox to an object into your scene
|
|
6
|
+
*
|
|
7
|
+
* @link [Example on needle.run](https://viewbox-demo-z23hmxbz2gkayo-z1nyzm6.needle.run/)
|
|
8
|
+
* @link [Scrollytelling Demo using animated Viewbox](https://scrollytelling-bike-z23hmxb2gnu5a.needle.run/)
|
|
9
|
+
* @link [Example on Stackblitz](https://stackblitz.com/edit/needle-engine-view-box-example)
|
|
10
|
+
*
|
|
11
|
+
* @example Add a Viewbox component to an object in your scene
|
|
12
|
+
* ```ts
|
|
13
|
+
const viewBox = new Object3D();
|
|
14
|
+
viewBox.scale.set(0, 0, 0);
|
|
15
|
+
viewBox.addComponent(ViewBox, { debug: true });
|
|
16
|
+
scene.add(viewBox);
|
|
17
|
+
|
|
18
|
+
* @category Web
|
|
19
|
+
* @group Components
|
|
20
|
+
* @component
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare class ViewBox extends Behaviour {
|
|
24
|
+
static readonly instances: ViewBox[];
|
|
25
|
+
/**
|
|
26
|
+
* The reference field of view is used to calculate the box size. This should usually be the same as your camera's fov.
|
|
27
|
+
* @default undefined (meaning it will use the camera fov on the first frame)
|
|
28
|
+
*/
|
|
29
|
+
referenceFieldOfView: number | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Enable debug logs and rendering for this component instance
|
|
32
|
+
*/
|
|
33
|
+
debug: boolean;
|
|
34
|
+
onEnable(): void;
|
|
35
|
+
onDisable(): void;
|
|
36
|
+
onBeforeRender(): void;
|
|
37
|
+
/**
|
|
38
|
+
* Cover fit
|
|
39
|
+
*/
|
|
40
|
+
private fit;
|
|
41
|
+
private projectBoxIntoCamera;
|
|
42
|
+
private _projectedBoxElement;
|
|
43
|
+
}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var ViewBox_1;
|
|
8
|
+
import { PerspectiveCamera } from "three";
|
|
9
|
+
import { isDevEnvironment } from "../../engine/debug/debug.js";
|
|
10
|
+
import { Gizmos } from "../../engine/engine_gizmos.js";
|
|
11
|
+
import { serializable } from "../../engine/engine_serialization_decorator.js";
|
|
12
|
+
import { getTempVector } from "../../engine/engine_three_utils.js";
|
|
13
|
+
import { registerType } from "../../engine/engine_typestore.js";
|
|
14
|
+
import { getParam } from "../../engine/engine_utils.js";
|
|
15
|
+
import { RGBAColor } from "../../engine/js-extensions/RGBAColor.js";
|
|
16
|
+
import { Behaviour } from "../Component.js";
|
|
17
|
+
const debugParam = getParam("debugviewbox");
|
|
18
|
+
const disabledGizmoColor = new RGBAColor(.5, .5, .5, .5);
|
|
19
|
+
/**
|
|
20
|
+
* This component can be used to automatically fit a certain box area into the camera view - no matter your screen size or aspect ratio.
|
|
21
|
+
*
|
|
22
|
+
* Add the ViewBox to an object into your scene
|
|
23
|
+
*
|
|
24
|
+
* @link [Example on needle.run](https://viewbox-demo-z23hmxbz2gkayo-z1nyzm6.needle.run/)
|
|
25
|
+
* @link [Scrollytelling Demo using animated Viewbox](https://scrollytelling-bike-z23hmxb2gnu5a.needle.run/)
|
|
26
|
+
* @link [Example on Stackblitz](https://stackblitz.com/edit/needle-engine-view-box-example)
|
|
27
|
+
*
|
|
28
|
+
* @example Add a Viewbox component to an object in your scene
|
|
29
|
+
* ```ts
|
|
30
|
+
const viewBox = new Object3D();
|
|
31
|
+
viewBox.scale.set(0, 0, 0);
|
|
32
|
+
viewBox.addComponent(ViewBox, { debug: true });
|
|
33
|
+
scene.add(viewBox);
|
|
34
|
+
|
|
35
|
+
* @category Web
|
|
36
|
+
* @group Components
|
|
37
|
+
* @component
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
let ViewBox = ViewBox_1 = class ViewBox extends Behaviour {
|
|
41
|
+
static instances = [];
|
|
42
|
+
/**
|
|
43
|
+
* The reference field of view is used to calculate the box size. This should usually be the same as your camera's fov.
|
|
44
|
+
* @default undefined (meaning it will use the camera fov on the first frame)
|
|
45
|
+
*/
|
|
46
|
+
referenceFieldOfView = undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Enable debug logs and rendering for this component instance
|
|
49
|
+
*/
|
|
50
|
+
debug = false;
|
|
51
|
+
onEnable() {
|
|
52
|
+
if (debugParam || this.debug || isDevEnvironment())
|
|
53
|
+
console.debug("[ViewBox] Using camera fov:", this.referenceFieldOfView);
|
|
54
|
+
// register instance
|
|
55
|
+
ViewBox_1.instances.push(this);
|
|
56
|
+
}
|
|
57
|
+
onDisable() {
|
|
58
|
+
if (debugParam || this.debug)
|
|
59
|
+
console.debug("[ViewBox] Disabled");
|
|
60
|
+
// unregister instance
|
|
61
|
+
const idx = ViewBox_1.instances.indexOf(this);
|
|
62
|
+
if (idx !== -1)
|
|
63
|
+
ViewBox_1.instances.splice(idx, 1);
|
|
64
|
+
this._projectedBoxElement?.remove();
|
|
65
|
+
}
|
|
66
|
+
onBeforeRender() {
|
|
67
|
+
if (this.context.isInXR)
|
|
68
|
+
return;
|
|
69
|
+
if (this.destroyed)
|
|
70
|
+
return;
|
|
71
|
+
const isActive = ViewBox_1.instances[ViewBox_1.instances.length - 1] === this;
|
|
72
|
+
if (!isActive) {
|
|
73
|
+
if (debugParam || this.debug) {
|
|
74
|
+
Gizmos.DrawWireBox(this.gameObject.worldPosition, this.gameObject.worldScale, disabledGizmoColor);
|
|
75
|
+
}
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (debugParam || this.debug)
|
|
79
|
+
Gizmos.DrawWireBox(this.gameObject.worldPosition, this.gameObject.worldScale, 0xdddd00, 0, true, this.gameObject.worldQuaternion);
|
|
80
|
+
// calculate box size to fit the camera frustrum size at the current position (just scale)
|
|
81
|
+
const camera = this.context.mainCamera;
|
|
82
|
+
if (!camera)
|
|
83
|
+
return;
|
|
84
|
+
if (!(camera instanceof PerspectiveCamera)) {
|
|
85
|
+
// TODO: support orthographic camera
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (this.referenceFieldOfView === undefined) {
|
|
89
|
+
this.referenceFieldOfView = camera.fov;
|
|
90
|
+
}
|
|
91
|
+
if (this.referenceFieldOfView === undefined || this.referenceFieldOfView <= 0) {
|
|
92
|
+
if (debugParam || this.debug)
|
|
93
|
+
console.warn("[ViewBox] No valid referenceFieldOfView set, cannot adjust box size:", this.referenceFieldOfView);
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const domWidth = this.context.domWidth;
|
|
97
|
+
const domHeight = this.context.domHeight;
|
|
98
|
+
let rectPosX = 0;
|
|
99
|
+
let rectPosY = 0;
|
|
100
|
+
let rectWidth = domWidth;
|
|
101
|
+
let rectHeight = domHeight;
|
|
102
|
+
let diffWidth = 1;
|
|
103
|
+
let diffHeight = 1;
|
|
104
|
+
// use focus rect if available
|
|
105
|
+
const focusRectSize = this.context.focusRectSize;
|
|
106
|
+
if (focusRectSize) {
|
|
107
|
+
// console.log(focusRectSize)
|
|
108
|
+
rectPosX = focusRectSize.x;
|
|
109
|
+
rectPosY = focusRectSize.y;
|
|
110
|
+
rectWidth = focusRectSize.width;
|
|
111
|
+
rectHeight = focusRectSize.height;
|
|
112
|
+
diffWidth = domWidth / rectWidth;
|
|
113
|
+
diffHeight = domHeight / rectHeight;
|
|
114
|
+
}
|
|
115
|
+
const view = camera.view;
|
|
116
|
+
const zoom = camera.zoom;
|
|
117
|
+
const aspect = camera.aspect;
|
|
118
|
+
const fov = camera.fov;
|
|
119
|
+
camera.view = null;
|
|
120
|
+
camera.zoom = 1;
|
|
121
|
+
camera.fov = this.referenceFieldOfView;
|
|
122
|
+
camera.updateProjectionMatrix();
|
|
123
|
+
const boxPosition = this.gameObject.worldPosition;
|
|
124
|
+
const boxScale = this.gameObject.worldScale;
|
|
125
|
+
const cameraPosition = camera.worldPosition;
|
|
126
|
+
const distance = cameraPosition.distanceTo(boxPosition);
|
|
127
|
+
// #region camera fixes
|
|
128
|
+
// If the camera is inside the box, move it out
|
|
129
|
+
const boxSizeMax = Math.max(boxScale.x, boxScale.y, boxScale.z);
|
|
130
|
+
const direction = getTempVector(cameraPosition).sub(boxPosition);
|
|
131
|
+
if (distance < boxSizeMax) {
|
|
132
|
+
// move camera out of bounds
|
|
133
|
+
if (this.debug || debugParam)
|
|
134
|
+
console.warn("[ViewBox] Moving camera out of bounds", distance, "<", boxSizeMax);
|
|
135
|
+
const positionDirection = getTempVector(direction);
|
|
136
|
+
positionDirection.y *= .00000001; // stay on horizontal plane mostly
|
|
137
|
+
positionDirection.normalize();
|
|
138
|
+
const lengthToMove = (boxSizeMax - distance);
|
|
139
|
+
const newPosition = cameraPosition.add(positionDirection.multiplyScalar(lengthToMove));
|
|
140
|
+
camera.worldPosition = newPosition.lerp(cameraPosition, 1 - this.context.time.deltaTime);
|
|
141
|
+
}
|
|
142
|
+
// Ensure the camera looks at the ViewBox
|
|
143
|
+
// TOOD: smooth lookat over multiple frames if we have multiple viewboxes
|
|
144
|
+
// const dot = direction.normalize().dot(camera.worldForward);
|
|
145
|
+
// if (dot < .9) {
|
|
146
|
+
// console.log(dot);
|
|
147
|
+
// const targetRotation = direction;
|
|
148
|
+
// const rotation = getTempQuaternion();
|
|
149
|
+
// rotation.setFromUnitVectors(camera.worldForward.multiplyScalar(-1), targetRotation);
|
|
150
|
+
// camera.worldQuaternion = rotation;
|
|
151
|
+
// camera.updateMatrixWorld();
|
|
152
|
+
// }
|
|
153
|
+
const boxPositionInCameraSpace = getTempVector(boxPosition);
|
|
154
|
+
camera.worldToLocal(boxPositionInCameraSpace);
|
|
155
|
+
camera.lookAt(boxPosition);
|
|
156
|
+
camera.updateMatrixWorld();
|
|
157
|
+
// #region calculate fit
|
|
158
|
+
const vFOV = this.referenceFieldOfView * Math.PI / 180; // convert vertical fov to radians
|
|
159
|
+
const height = 2 * Math.tan(vFOV / 2) * distance; // visible height
|
|
160
|
+
const width = height * camera.aspect; // visible width
|
|
161
|
+
const projectedBox = this.projectBoxIntoCamera(camera, 1);
|
|
162
|
+
// return
|
|
163
|
+
const boxWidth = (projectedBox.maxX - projectedBox.minX);
|
|
164
|
+
const boxHeight = (projectedBox.maxY - projectedBox.minY);
|
|
165
|
+
const scale = this.fit(boxWidth * camera.aspect, boxHeight, width / diffWidth, height / diffHeight);
|
|
166
|
+
// console.log({ scale, width, height, boxWidth: boxWidth * camera.aspect, boxHeight, diffWidth, diffHeight, aspect: camera.aspect, distance })
|
|
167
|
+
// this.context.focusRectSettings.zoom = 1.39;
|
|
168
|
+
// if (!this.context.focusRect) this.context.setCameraFocusRect(this.context.domElement);
|
|
169
|
+
// return
|
|
170
|
+
const vec = getTempVector(boxPosition);
|
|
171
|
+
vec.project(camera);
|
|
172
|
+
this.context.focusRectSettings.offsetX = vec.x;
|
|
173
|
+
this.context.focusRectSettings.offsetY = vec.y;
|
|
174
|
+
this.context.focusRectSettings.zoom = scale / (height * .5);
|
|
175
|
+
// if we don't have a focus rect yet, set it to the dom element
|
|
176
|
+
if (!this.context.focusRect)
|
|
177
|
+
this.context.setCameraFocusRect(this.context.domElement);
|
|
178
|
+
// Reset values
|
|
179
|
+
camera.view = view;
|
|
180
|
+
camera.zoom = zoom;
|
|
181
|
+
camera.aspect = aspect;
|
|
182
|
+
camera.fov = fov;
|
|
183
|
+
// camera.updateProjectionMatrix();
|
|
184
|
+
// BACKLOG: some code for box scale of an object (different component)
|
|
185
|
+
// this.gameObject.worldScale = getTempVector(width, height, worldscale.z);
|
|
186
|
+
// this.gameObject.scale.multiplyScalar(.98)
|
|
187
|
+
// const minscale = Math.min(width, height);
|
|
188
|
+
// console.log(width, height);
|
|
189
|
+
// this.gameObject.worldScale = getTempVector(scale, scale, scale);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Cover fit
|
|
193
|
+
*/
|
|
194
|
+
fit(width1, height1, width2, height2) {
|
|
195
|
+
const scaleX = width2 / width1;
|
|
196
|
+
const scaleY = height2 / height1;
|
|
197
|
+
return Math.min(scaleX, scaleY);
|
|
198
|
+
}
|
|
199
|
+
projectBoxIntoCamera(camera, _factor) {
|
|
200
|
+
const factor = .5 * _factor;
|
|
201
|
+
const corners = [
|
|
202
|
+
getTempVector(-factor, -factor, -factor),
|
|
203
|
+
getTempVector(factor, -factor, -factor),
|
|
204
|
+
getTempVector(-factor, factor, -factor),
|
|
205
|
+
getTempVector(factor, factor, -factor),
|
|
206
|
+
getTempVector(-factor, -factor, factor),
|
|
207
|
+
getTempVector(factor, -factor, factor),
|
|
208
|
+
getTempVector(-factor, factor, factor),
|
|
209
|
+
getTempVector(factor, factor, factor),
|
|
210
|
+
];
|
|
211
|
+
let minX = Number.POSITIVE_INFINITY;
|
|
212
|
+
let maxX = Number.NEGATIVE_INFINITY;
|
|
213
|
+
let minY = Number.POSITIVE_INFINITY;
|
|
214
|
+
let maxY = Number.NEGATIVE_INFINITY;
|
|
215
|
+
for (let i = 0; i < corners.length; i++) {
|
|
216
|
+
const c = corners[i];
|
|
217
|
+
c.applyMatrix4(this.gameObject.matrixWorld);
|
|
218
|
+
c.project(camera);
|
|
219
|
+
if (c.x < minX)
|
|
220
|
+
minX = c.x;
|
|
221
|
+
if (c.x > maxX)
|
|
222
|
+
maxX = c.x;
|
|
223
|
+
if (c.y < minY)
|
|
224
|
+
minY = c.y;
|
|
225
|
+
if (c.y > maxY)
|
|
226
|
+
maxY = c.y;
|
|
227
|
+
}
|
|
228
|
+
if (debugParam) {
|
|
229
|
+
if (!this._projectedBoxElement) {
|
|
230
|
+
this._projectedBoxElement = document.createElement("div");
|
|
231
|
+
}
|
|
232
|
+
if (this._projectedBoxElement.parentElement !== this.context.domElement)
|
|
233
|
+
this.context.domElement.appendChild(this._projectedBoxElement);
|
|
234
|
+
this._projectedBoxElement.style.position = "fixed";
|
|
235
|
+
// dotted but with larger gaps
|
|
236
|
+
this._projectedBoxElement.style.outline = "2px dashed rgba(255,0,0,.5)";
|
|
237
|
+
this._projectedBoxElement.style.left = ((minX * .5 + .5) * this.context.domWidth) + "px";
|
|
238
|
+
this._projectedBoxElement.style.top = ((-maxY * .5 + .5) * this.context.domHeight) + "px";
|
|
239
|
+
this._projectedBoxElement.style.width = ((maxX - minX) * .5 * this.context.domWidth) + "px";
|
|
240
|
+
this._projectedBoxElement.style.height = ((maxY - minY) * .5 * this.context.domHeight) + "px";
|
|
241
|
+
this._projectedBoxElement.style.pointerEvents = "none";
|
|
242
|
+
this._projectedBoxElement.style.zIndex = "1000";
|
|
243
|
+
}
|
|
244
|
+
return { minX, maxX, minY, maxY };
|
|
245
|
+
}
|
|
246
|
+
_projectedBoxElement = null;
|
|
247
|
+
};
|
|
248
|
+
__decorate([
|
|
249
|
+
serializable()
|
|
250
|
+
], ViewBox.prototype, "referenceFieldOfView", void 0);
|
|
251
|
+
__decorate([
|
|
252
|
+
serializable()
|
|
253
|
+
], ViewBox.prototype, "debug", void 0);
|
|
254
|
+
ViewBox = ViewBox_1 = __decorate([
|
|
255
|
+
registerType
|
|
256
|
+
], ViewBox);
|
|
257
|
+
export { ViewBox };
|
|
258
|
+
//# sourceMappingURL=ViewBox.js.map
|