@splinetool/runtime 0.9.39 → 0.9.40
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/README.md +7 -5
- package/build/runtime.js +94 -102
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -28,11 +28,13 @@ const canvas = document.getElementById('canvas3d');
|
|
|
28
28
|
|
|
29
29
|
// start the application and load the scene
|
|
30
30
|
const app = new Application(canvas);
|
|
31
|
-
app.load('https://prod.spline.design/
|
|
31
|
+
app.load('https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode');
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
You should be able to see the scene you exported in your canvas.
|
|
35
35
|
|
|
36
|
+
> :warning: Only **.splinecode** files should be loaded through this API. `.spline` files are meant to be used in the editor.
|
|
37
|
+
|
|
36
38
|
### Read and modify Spline objects
|
|
37
39
|
|
|
38
40
|
You can query any Spline object via `findObjectByName` or `findObjectById`.
|
|
@@ -45,7 +47,7 @@ import { Application } from '@splinetool/runtime';
|
|
|
45
47
|
const canvas = document.getElementById('canvas3d');
|
|
46
48
|
const app = new Application(canvas);
|
|
47
49
|
app
|
|
48
|
-
.load('https://prod.spline.design/
|
|
50
|
+
.load('https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode')
|
|
49
51
|
.then(() => {
|
|
50
52
|
const obj = spline.findObjectByName('my object');
|
|
51
53
|
// or
|
|
@@ -68,7 +70,7 @@ import { Application } from '@splinetool/runtime';
|
|
|
68
70
|
const canvas = document.getElementById('canvas3d');
|
|
69
71
|
const app = new Application(canvas);
|
|
70
72
|
app
|
|
71
|
-
.load('https://prod.spline.design/
|
|
73
|
+
.load('https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode')
|
|
72
74
|
.then(() => {
|
|
73
75
|
app.addEventListener('mousedown', (e) => {
|
|
74
76
|
if (e.target.name === 'my object') {
|
|
@@ -94,7 +96,7 @@ import { Application } from '@splinetool/runtime';
|
|
|
94
96
|
const canvas = document.getElementById('canvas3d');
|
|
95
97
|
const app = new Application(canvas);
|
|
96
98
|
app
|
|
97
|
-
.load('https://prod.spline.design/
|
|
99
|
+
.load('https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode')
|
|
98
100
|
.then(() => {
|
|
99
101
|
app.emitEvent('mouseHover', '8E8C2DDD-18B6-4C54-861D-7ED2519DE20E');
|
|
100
102
|
});
|
|
@@ -108,7 +110,7 @@ import { Application } from '@splinetool/runtime';
|
|
|
108
110
|
const canvas = document.getElementById('canvas3d');
|
|
109
111
|
const app = new Application(canvas);
|
|
110
112
|
app
|
|
111
|
-
.load('https://prod.spline.design/
|
|
113
|
+
.load('https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode')
|
|
112
114
|
.then(() => {
|
|
113
115
|
const obj = spline.findObjectByName('my object');
|
|
114
116
|
objectToAnimate.emitEvent('mouseHover');
|