@splinetool/runtime
Advanced tools
Comparing version 0.9.65 to 0.9.66
{ | ||
"name": "@splinetool/runtime", | ||
"version": "0.9.65", | ||
"version": "0.9.66", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "main": "./build/runtime.js", |
@@ -52,7 +52,7 @@ # Spline Runtime | ||
.then(() => { | ||
const obj = spline.findObjectByName('my object'); | ||
const obj = spline.findObjectByName('Rectangle'); | ||
// or | ||
// const obj = spline.findObjectById('8E8C2DDD-18B6-4C54-861D-7ED2519DE20E'); | ||
console.log(obj); // Spline Object => { name: 'my object', id: '8E8C2DDD-18B6-4C54-861D-7ED2519DE20E', position: {}, ... } | ||
console.log(obj); // Spline Object => { name: 'Rectangle', id: '8E8C2DDD-18B6-4C54-861D-7ED2519DE20E', position: {}, ... } | ||
@@ -77,4 +77,4 @@ // move the object in 3D space | ||
app.addEventListener('mousedown', (e) => { | ||
if (e.target.name === 'my object') { | ||
// doSomething(); | ||
if (e.target.name === 'Rectangle') { | ||
console.log('I have been clicked!'); | ||
} | ||
@@ -91,3 +91,3 @@ }); | ||
You can use the `emitEvent` function, passing the [event type](#spline-events) and the ID of your object. | ||
You can use the `emitEvent` function, passing the [event type](#spline-events) and the name or ID of your object. | ||
@@ -104,3 +104,3 @@ _(You can get the ID of the object in the `Develop` pane of the right sidebar)._ | ||
.then(() => { | ||
app.emitEvent('mouseHover', '8E8C2DDD-18B6-4C54-861D-7ED2519DE20E'); | ||
app.emitEvent('mouseHover', 'Rectangle'); | ||
}); | ||
@@ -119,3 +119,3 @@ ``` | ||
.then(() => { | ||
const obj = spline.findObjectByName('my object'); | ||
const obj = spline.findObjectByName('Rectangle'); | ||
objectToAnimate.emitEvent('mouseHover'); | ||
@@ -133,10 +133,10 @@ }); | ||
| Name | Type | Description | | ||
| ------------------ | ---------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------- | | ||
| `emitEvent` | `(eventName: SplineEventName, uuid: string) => void` | Triggers a Spline event associated to an object with provided uuid in reverse order. Starts from first state to last state. | | ||
| `emitEventReverse` | `(eventName: SplineEventName, uuid: string) => void` | Triggers a Spline event associated to an object with provided uuid in reverse order. Starts from last state to first state. | | ||
| `findObjectById` | `(uuid: string) => SPEObject` | Searches through scene's children and returns the object with that uuid. | | ||
| `findObjectByName` | `(name: string) => SPEObject` | Searches through scene's children and returns the first object with that name. | | ||
| `setZoom` | `(zoom: number) => void` | Sets the initial zoom of the scene. | | ||
| `setSize` | `(width: number, height:number) => void` | Sets the size of the application and canvas. When called, Spline will stop automatic size updates. | | ||
| Name | Type | Description | | ||
| ------------------ | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | | ||
| `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. | | ||
| `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. | | ||
| `findObjectById` | `(uuid: string) => SPEObject` | Searches through scene's children and returns the object with that uuid. | | ||
| `findObjectByName` | `(name: string) => SPEObject` | Searches through scene's children and returns the first object with that name. | | ||
| `setZoom` | `(zoom: number) => void` | Sets the initial zoom of the scene. | | ||
| `setSize` | `(width: number, height:number) => void` | Sets the size of the application and canvas. When called, Spline will stop automatic size updates. | | ||
@@ -143,0 +143,0 @@ ### Spline Events |
@@ -75,15 +75,15 @@ declare module '@splinetool/runtime' { | ||
/** | ||
* Triggers a Spline event associated to an object with provided uuid. | ||
* Triggers a Spline event associated to an object with provided name or uuid. | ||
* Starts from first state to last state. | ||
* @param {string} eventName String that matches Spline event's name | ||
* @param {string} uuid | ||
* @param {string} nameOrUuid The name or uuid of the object | ||
*/ | ||
emitEvent(eventName: SplineEventName, uuid: string): void; | ||
emitEvent(eventName: SplineEventName, nameOrUuid: string): void; | ||
/** | ||
* Triggers a Spline event associated to an object with provided uuid in reverse order. | ||
* Triggers a Spline event associated to an object with provided name or uuid in reverse order. | ||
* Starts from last state to first state. | ||
* @param {string} eventName String that matches Spline event's name | ||
* @param {string} uuid | ||
* @param {string} nameOrUuid The name or uuid of the object | ||
*/ | ||
emitEventReverse(eventName: SplineEventName, uuid: string): void; | ||
emitEventReverse(eventName: SplineEventName, nameOrUuid: string): void; | ||
/** | ||
@@ -90,0 +90,0 @@ * Add an event listener for Spline events |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
2528155