@splinetool/loader 0.9.8

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 ADDED
@@ -0,0 +1,50 @@
1
+ # Spline Loader
2
+
3
+ > Three.js loader for `.splinecode` files.
4
+
5
+ It returns a three.js compatible representation of the file scene.
6
+
7
+ You should use this package if you want to access your Spline objects and materials from code and manipulate them yourself in a Three.js environment.
8
+
9
+ If you want to display your Spline scene with interactions and states matching Spline play mode, we recommend you use [spline-runtime](https://www.npmjs.com/package/@splinetool/runtime) instead.
10
+
11
+ > :warning: Only **.splinecode** files should be loaded through this API. `.spline` files are meant to be used in the editor.
12
+
13
+ ## Installation
14
+
15
+ ```
16
+ npm install @splinetool/loader
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```js
22
+ import SplineLoader from '@splinetool/loader';
23
+
24
+ // Instantiate a loader
25
+ const loader = new SplineLoader();
26
+
27
+ // Load a .splinecode file
28
+ loader.load(
29
+ // path to the .splinecode file, either from the Spline servers or local
30
+ 'https://prod.spline.design/2qM3cW5Cx15m3cJ7/scene.splinecode',
31
+ // called when the resource is loaded
32
+ (splineScene) => {
33
+ scene.add(splineScene);
34
+ },
35
+ null,
36
+ // called when loading has errors
37
+ (error) => {
38
+ console.log('An error happened');
39
+ }
40
+ );
41
+ ```
42
+
43
+ ## Limitations
44
+
45
+ This loader allows most Spline objects and materials to be rendered directly into three.js without a Spline runtime. Still it's possible you'll notice some differences between the loaded scene and what it looked like in the Spline editor because we fallback missing Spline capabilities to "the next best thing" in order for it to work.
46
+ Think of this Loader as a way to get scenegraph, geometries and materials.
47
+
48
+ - The **Glass layer** is only partially supported when used outside of the Spline Runtime. In THREE.js, transmission does not handle transparent objects. We advise against combining Glass layers and alpha objects in the same scene.
49
+ - All Events and Interactions won't be included in the loaded objects, if you use this package it implies you will use code to handle interactions and animations on your own.
50
+ - Spline Postprocessing also won't be included.