@splinetool/runtime 0.9.65 → 0.9.68
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 +15 -15
- package/build/runtime.cjs +197 -197
- package/build/runtime.js +197 -197
- package/package.json +1 -1
- package/runtime.d.ts +6 -6
package/README.md
CHANGED
|
@@ -49,11 +49,11 @@ const app = new Application(canvas);
|
|
|
49
49
|
app
|
|
50
50
|
.load('https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode')
|
|
51
51
|
.then(() => {
|
|
52
|
-
const obj = spline.findObjectByName('
|
|
52
|
+
const obj = spline.findObjectByName('Rectangle');
|
|
53
53
|
// or
|
|
54
54
|
// const obj = spline.findObjectById('8E8C2DDD-18B6-4C54-861D-7ED2519DE20E');
|
|
55
55
|
|
|
56
|
-
console.log(obj); // Spline Object => { name: '
|
|
56
|
+
console.log(obj); // Spline Object => { name: 'Rectangle', id: '8E8C2DDD-18B6-4C54-861D-7ED2519DE20E', position: {}, ... }
|
|
57
57
|
|
|
58
58
|
// move the object in 3D space
|
|
59
59
|
obj.position.x += 10;
|
|
@@ -73,8 +73,8 @@ app
|
|
|
73
73
|
.load('https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode')
|
|
74
74
|
.then(() => {
|
|
75
75
|
app.addEventListener('mousedown', (e) => {
|
|
76
|
-
if (e.target.name === '
|
|
77
|
-
|
|
76
|
+
if (e.target.name === 'Rectangle') {
|
|
77
|
+
console.log('I have been clicked!');
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
});
|
|
@@ -86,7 +86,7 @@ You can find a list of all of the Spline Event listeners in the [API](#api) sect
|
|
|
86
86
|
|
|
87
87
|
You can trigger any animation Event you set in the Events panel in the Spline Editor.
|
|
88
88
|
|
|
89
|
-
You can use the `emitEvent` function, passing the [event type](#spline-events) and the ID of your object.
|
|
89
|
+
You can use the `emitEvent` function, passing the [event type](#spline-events) and the name or ID of your object.
|
|
90
90
|
|
|
91
91
|
_(You can get the ID of the object in the `Develop` pane of the right sidebar)._
|
|
92
92
|
|
|
@@ -98,7 +98,7 @@ const app = new Application(canvas);
|
|
|
98
98
|
app
|
|
99
99
|
.load('https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode')
|
|
100
100
|
.then(() => {
|
|
101
|
-
app.emitEvent('mouseHover', '
|
|
101
|
+
app.emitEvent('mouseHover', 'Rectangle');
|
|
102
102
|
});
|
|
103
103
|
```
|
|
104
104
|
|
|
@@ -112,7 +112,7 @@ const app = new Application(canvas);
|
|
|
112
112
|
app
|
|
113
113
|
.load('https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode')
|
|
114
114
|
.then(() => {
|
|
115
|
-
const obj = spline.findObjectByName('
|
|
115
|
+
const obj = spline.findObjectByName('Rectangle');
|
|
116
116
|
objectToAnimate.emitEvent('mouseHover');
|
|
117
117
|
});
|
|
118
118
|
```
|
|
@@ -125,14 +125,14 @@ You can find a list of all of the Spline Events you can pass to the `emitEvent`
|
|
|
125
125
|
|
|
126
126
|
You can call all these different methods on the Spline `Application` instance.
|
|
127
127
|
|
|
128
|
-
| Name | Type
|
|
129
|
-
| ------------------ |
|
|
130
|
-
| `emitEvent` | `(eventName: SplineEventName,
|
|
131
|
-
| `emitEventReverse` | `(eventName: SplineEventName,
|
|
132
|
-
| `findObjectById` | `(uuid: string) => SPEObject`
|
|
133
|
-
| `findObjectByName` | `(name: string) => SPEObject`
|
|
134
|
-
| `setZoom` | `(zoom: number) => void`
|
|
135
|
-
| `setSize` | `(width: number, height:number) => void`
|
|
128
|
+
| Name | Type | Description |
|
|
129
|
+
| ------------------ | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
130
|
+
| `emitEvent` | `(eventName: SplineEventName, nameOrUuid: string) => void` | Triggers a Spline event associated to an object with provided name or uuid in reverse order. Starts from first state to last state. |
|
|
131
|
+
| `emitEventReverse` | `(eventName: SplineEventName, nameOrUuid: string) => void` | Triggers a Spline event associated to an object with provided name or uuid in reverse order. Starts from last state to first state. |
|
|
132
|
+
| `findObjectById` | `(uuid: string) => SPEObject` | Searches through scene's children and returns the object with that uuid. |
|
|
133
|
+
| `findObjectByName` | `(name: string) => SPEObject` | Searches through scene's children and returns the first object with that name. |
|
|
134
|
+
| `setZoom` | `(zoom: number) => void` | Sets the initial zoom of the scene. |
|
|
135
|
+
| `setSize` | `(width: number, height:number) => void` | Sets the size of the application and canvas. When called, Spline will stop automatic size updates. |
|
|
136
136
|
|
|
137
137
|
### Spline Events
|
|
138
138
|
|