three-render-objects 1.29.3 → 1.29.5
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/three-render-objects.js +1832 -1586
- package/dist/three-render-objects.js.map +1 -1
- package/dist/three-render-objects.min.js +2 -2
- package/dist/three-render-objects.mjs +49 -58
- package/package.json +12 -12
|
@@ -5,14 +5,14 @@ import { FlyControls } from 'three/examples/jsm/controls/FlyControls.js';
|
|
|
5
5
|
import { EffectComposer } from 'three/examples/jsm/postprocessing/EffectComposer.js';
|
|
6
6
|
import { RenderPass } from 'three/examples/jsm/postprocessing/RenderPass.js';
|
|
7
7
|
import { parseToRgb, opacify } from 'polished';
|
|
8
|
-
import
|
|
8
|
+
import { Tween, Easing, Group } from '@tweenjs/tween.js';
|
|
9
9
|
import accessorFn from 'accessor-fn';
|
|
10
10
|
import Kapsule from 'kapsule';
|
|
11
11
|
|
|
12
12
|
function styleInject(css, ref) {
|
|
13
13
|
if (ref === void 0) ref = {};
|
|
14
14
|
var insertAt = ref.insertAt;
|
|
15
|
-
if (
|
|
15
|
+
if (typeof document === 'undefined') {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
18
|
var head = document.head || document.getElementsByTagName('head')[0];
|
|
@@ -37,6 +37,28 @@ function styleInject(css, ref) {
|
|
|
37
37
|
var css_248z = ".scene-nav-info {\n bottom: 5px;\n width: 100%;\n text-align: center;\n color: slategrey;\n opacity: 0.7;\n font-size: 10px;\n}\n\n.scene-tooltip {\n top: 0;\n color: lavender;\n font-size: 15px;\n}\n\n.scene-nav-info, .scene-tooltip {\n position: absolute;\n font-family: sans-serif;\n pointer-events: none;\n user-select: none;\n}\n\n.scene-container canvas:focus {\n outline: none;\n}";
|
|
38
38
|
styleInject(css_248z);
|
|
39
39
|
|
|
40
|
+
function _arrayLikeToArray(r, a) {
|
|
41
|
+
(null == a || a > r.length) && (a = r.length);
|
|
42
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
43
|
+
return n;
|
|
44
|
+
}
|
|
45
|
+
function _arrayWithHoles(r) {
|
|
46
|
+
if (Array.isArray(r)) return r;
|
|
47
|
+
}
|
|
48
|
+
function _arrayWithoutHoles(r) {
|
|
49
|
+
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
50
|
+
}
|
|
51
|
+
function _defineProperty(e, r, t) {
|
|
52
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
53
|
+
value: t,
|
|
54
|
+
enumerable: !0,
|
|
55
|
+
configurable: !0,
|
|
56
|
+
writable: !0
|
|
57
|
+
}) : e[r] = t, e;
|
|
58
|
+
}
|
|
59
|
+
function _iterableToArray(r) {
|
|
60
|
+
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
61
|
+
}
|
|
40
62
|
function _iterableToArrayLimit(r, l) {
|
|
41
63
|
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
42
64
|
if (null != t) {
|
|
@@ -48,10 +70,7 @@ function _iterableToArrayLimit(r, l) {
|
|
|
48
70
|
f = !0,
|
|
49
71
|
o = !1;
|
|
50
72
|
try {
|
|
51
|
-
if (i = (t = t.call(r)).next, 0 === l)
|
|
52
|
-
if (Object(t) !== t) return;
|
|
53
|
-
f = !1;
|
|
54
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
73
|
+
if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
55
74
|
} catch (r) {
|
|
56
75
|
o = !0, n = r;
|
|
57
76
|
} finally {
|
|
@@ -64,6 +83,18 @@ function _iterableToArrayLimit(r, l) {
|
|
|
64
83
|
return a;
|
|
65
84
|
}
|
|
66
85
|
}
|
|
86
|
+
function _nonIterableRest() {
|
|
87
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
88
|
+
}
|
|
89
|
+
function _nonIterableSpread() {
|
|
90
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
91
|
+
}
|
|
92
|
+
function _slicedToArray(r, e) {
|
|
93
|
+
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
94
|
+
}
|
|
95
|
+
function _toConsumableArray(r) {
|
|
96
|
+
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
97
|
+
}
|
|
67
98
|
function _toPrimitive(t, r) {
|
|
68
99
|
if ("object" != typeof t || !t) return t;
|
|
69
100
|
var e = t[Symbol.toPrimitive];
|
|
@@ -76,55 +107,14 @@ function _toPrimitive(t, r) {
|
|
|
76
107
|
}
|
|
77
108
|
function _toPropertyKey(t) {
|
|
78
109
|
var i = _toPrimitive(t, "string");
|
|
79
|
-
return "symbol" == typeof i ? i :
|
|
110
|
+
return "symbol" == typeof i ? i : i + "";
|
|
80
111
|
}
|
|
81
|
-
function
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
enumerable: true,
|
|
87
|
-
configurable: true,
|
|
88
|
-
writable: true
|
|
89
|
-
});
|
|
90
|
-
} else {
|
|
91
|
-
obj[key] = value;
|
|
112
|
+
function _unsupportedIterableToArray(r, a) {
|
|
113
|
+
if (r) {
|
|
114
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
115
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
116
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
92
117
|
}
|
|
93
|
-
return obj;
|
|
94
|
-
}
|
|
95
|
-
function _slicedToArray(arr, i) {
|
|
96
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
97
|
-
}
|
|
98
|
-
function _toConsumableArray(arr) {
|
|
99
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
|
100
|
-
}
|
|
101
|
-
function _arrayWithoutHoles(arr) {
|
|
102
|
-
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
|
103
|
-
}
|
|
104
|
-
function _arrayWithHoles(arr) {
|
|
105
|
-
if (Array.isArray(arr)) return arr;
|
|
106
|
-
}
|
|
107
|
-
function _iterableToArray(iter) {
|
|
108
|
-
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
109
|
-
}
|
|
110
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
111
|
-
if (!o) return;
|
|
112
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
113
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
114
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
115
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
116
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
117
|
-
}
|
|
118
|
-
function _arrayLikeToArray(arr, len) {
|
|
119
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
120
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
121
|
-
return arr2;
|
|
122
|
-
}
|
|
123
|
-
function _nonIterableSpread() {
|
|
124
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
125
|
-
}
|
|
126
|
-
function _nonIterableRest() {
|
|
127
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
128
118
|
}
|
|
129
119
|
|
|
130
120
|
var three = window.THREE ? window.THREE // Prefer consumption from global THREE, if exists
|
|
@@ -233,7 +223,7 @@ var threeRenderObjects = Kapsule({
|
|
|
233
223
|
methods: {
|
|
234
224
|
tick: function tick(state) {
|
|
235
225
|
if (state.initialised) {
|
|
236
|
-
state.controls.update && state.controls.update(state.clock.getDelta()); // timedelta is required for fly controls
|
|
226
|
+
state.controls.update && state.controls.update(Math.min(1, state.clock.getDelta())); // timedelta is required for fly controls
|
|
237
227
|
|
|
238
228
|
state.postProcessingComposer ? state.postProcessingComposer.render() // if using postprocessing, switch the output to it
|
|
239
229
|
: state.renderer.render(state.scene, state.camera);
|
|
@@ -259,7 +249,7 @@ var threeRenderObjects = Kapsule({
|
|
|
259
249
|
state.hoverObj = topObject;
|
|
260
250
|
}
|
|
261
251
|
}
|
|
262
|
-
|
|
252
|
+
state.tweenGroup.update(); // update camera animation tweens
|
|
263
253
|
}
|
|
264
254
|
return this;
|
|
265
255
|
},
|
|
@@ -290,10 +280,10 @@ var threeRenderObjects = Kapsule({
|
|
|
290
280
|
} else {
|
|
291
281
|
var camPos = Object.assign({}, camera.position);
|
|
292
282
|
var camLookAt = getLookAt();
|
|
293
|
-
new
|
|
283
|
+
state.tweenGroup.add(new Tween(camPos).to(finalPos, transitionDuration).easing(Easing.Quadratic.Out).onUpdate(setCameraPos).start());
|
|
294
284
|
|
|
295
285
|
// Face direction in 1/3rd of time
|
|
296
|
-
new
|
|
286
|
+
state.tweenGroup.add(new Tween(camLookAt).to(finalLookAt, transitionDuration / 3).easing(Easing.Quadratic.Out).onUpdate(setLookAt).start());
|
|
297
287
|
}
|
|
298
288
|
return this;
|
|
299
289
|
}
|
|
@@ -424,7 +414,8 @@ var threeRenderObjects = Kapsule({
|
|
|
424
414
|
return {
|
|
425
415
|
scene: new three.Scene(),
|
|
426
416
|
camera: new three.PerspectiveCamera(),
|
|
427
|
-
clock: new three.Clock()
|
|
417
|
+
clock: new three.Clock(),
|
|
418
|
+
tweenGroup: new Group()
|
|
428
419
|
};
|
|
429
420
|
},
|
|
430
421
|
init: function init(domNode, state) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "three-render-objects",
|
|
3
|
-
"version": "1.29.
|
|
3
|
+
"version": "1.29.5",
|
|
4
4
|
"description": "Easy way to render ThreeJS objects with built-in interaction defaults",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"prepare": "npm run build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@tweenjs/tween.js": "18 -
|
|
48
|
+
"@tweenjs/tween.js": "18 - 25",
|
|
49
49
|
"accessor-fn": "1",
|
|
50
50
|
"kapsule": "1",
|
|
51
51
|
"polished": "4"
|
|
@@ -54,19 +54,19 @@
|
|
|
54
54
|
"three": "*"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@babel/core": "^7.
|
|
58
|
-
"@babel/preset-env": "^7.
|
|
57
|
+
"@babel/core": "^7.25.2",
|
|
58
|
+
"@babel/preset-env": "^7.25.4",
|
|
59
59
|
"@rollup/plugin-babel": "^6.0.4",
|
|
60
|
-
"@rollup/plugin-commonjs": "^
|
|
61
|
-
"@rollup/plugin-node-resolve": "^15.
|
|
60
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
61
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
62
62
|
"@rollup/plugin-terser": "^0.4.4",
|
|
63
|
-
"postcss": "^8.4.
|
|
64
|
-
"rimraf": "^
|
|
65
|
-
"rollup": "^4.
|
|
66
|
-
"rollup-plugin-dts": "^6.1.
|
|
63
|
+
"postcss": "^8.4.47",
|
|
64
|
+
"rimraf": "^6.0.1",
|
|
65
|
+
"rollup": "^4.22.4",
|
|
66
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
67
67
|
"rollup-plugin-postcss": "^4.0.2",
|
|
68
|
-
"three": "^0.
|
|
69
|
-
"typescript": "^5.
|
|
68
|
+
"three": "^0.168.0",
|
|
69
|
+
"typescript": "^5.6.2"
|
|
70
70
|
},
|
|
71
71
|
"engines": {
|
|
72
72
|
"node": ">=12"
|