string-tune-3d 0.0.4 → 0.0.6
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/index.cjs +251 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +178 -2
- package/dist/index.d.ts +178 -2
- package/dist/index.js +251 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +251 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/readme.md +50 -50
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "string-tune-3d",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "StringTune-3D is a powerful 3D graphics adapter library that provides a unified interface for working with different 3D engines like Three.js. Part of the StringTune ecosystem, it enables seamless integration and synchronization of 3D objects, scenes, cameras, and lights across various rendering engines.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"3d",
|
package/readme.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
**StringTune-3D** is a powerful 3D graphics module for the StringTune ecosystem. It provides seamless integration of 3D objects with HTML elements using a simple attribute-based approach. StringTune-3D works exclusively within the StringTune framework and enables automatic synchronization between DOM elements and 3D objects rendered via Three.js.
|
|
6
6
|
|
|
7
|
-
> **Important**: StringTune-3D is a module for StringTune and requires the base `@fiddle-digital/string-tune` package to function.
|
|
7
|
+
> **Important**: StringTune-3D is a module for StringTune and requires the base `@fiddle-digital/string-tune` package to function.
|
|
8
8
|
|
|
9
9
|
### Key Features
|
|
10
10
|
|
|
@@ -44,25 +44,25 @@ npm install three
|
|
|
44
44
|
### 1. Import Dependencies
|
|
45
45
|
|
|
46
46
|
```typescript
|
|
47
|
-
import { StringTune } from "@fiddle-digital/string-tune";
|
|
48
|
-
import { String3D, ThreeJSProvider } from "string-tune-3d";
|
|
49
|
-
import * as THREE from "three";
|
|
50
|
-
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
47
|
+
import { StringTune } from "@fiddle-digital/string-tune";
|
|
48
|
+
import { String3D, ThreeJSProvider } from "string-tune-3d";
|
|
49
|
+
import * as THREE from "three";
|
|
50
|
+
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
### 2. Initialize StringTune with 3D Support
|
|
54
54
|
|
|
55
55
|
```typescript
|
|
56
|
-
// Set the 3D provider (Three.js + model loaders)
|
|
57
|
-
String3D.setProvider(
|
|
58
|
-
new ThreeJSProvider(THREE, {
|
|
59
|
-
gltf: GLTFLoader,
|
|
60
|
-
})
|
|
61
|
-
);
|
|
56
|
+
// Set the 3D provider (Three.js + model loaders)
|
|
57
|
+
String3D.setProvider(
|
|
58
|
+
new ThreeJSProvider(THREE, {
|
|
59
|
+
gltf: GLTFLoader,
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
62
|
|
|
63
63
|
// Get StringTune instance and register the 3D module
|
|
64
|
-
const stringTune = StringTune.getInstance();
|
|
65
|
-
stringTune.use(String3D, { modelLoaderType: "gltf" });
|
|
64
|
+
const stringTune = StringTune.getInstance();
|
|
65
|
+
stringTune.use(String3D, { modelLoaderType: "gltf" });
|
|
66
66
|
|
|
67
67
|
// Start StringTune
|
|
68
68
|
stringTune.start(60); // 60 FPS
|
|
@@ -123,41 +123,41 @@ stringTune.start(60); // 60 FPS
|
|
|
123
123
|
### Core Attributes
|
|
124
124
|
|
|
125
125
|
- `string="3d"` - Enables 3D for the element
|
|
126
|
-
- `string-3d="<type>"` - Type of 3D object: `box`, `sphere`, `plane`, `ambientLight`, `directionalLight`, etc.
|
|
127
|
-
- `string-3d="model"` - Loads a model (e.g. glTF)
|
|
128
|
-
|
|
129
|
-
### Material & Appearance
|
|
130
|
-
|
|
131
|
-
- `string-3d-material="<type>[<color>]"` - Material type: `basic`, `standard`
|
|
132
|
-
- `string-3d-color="<color>"` - Object or light color
|
|
133
|
-
- `string-3d-opacity="<number>"` - Opacity (0-1)
|
|
134
|
-
- `string-3d-metalness="<number>"` - Metalness (standard only)
|
|
135
|
-
- `string-3d-roughness="<number>"` - Roughness (standard only)
|
|
136
|
-
|
|
137
|
-
### Lighting
|
|
138
|
-
|
|
139
|
-
- `string-3d-intensity="<number>"` - Light intensity
|
|
140
|
-
|
|
141
|
-
### Models
|
|
142
|
-
|
|
143
|
-
- `string-3d-model="<url>"` - Path to model (e.g. `.gltf`, `.glb`)
|
|
144
|
-
- `string-3d-model-loader="<type>"` - Loader override per element (e.g. `gltf`)
|
|
145
|
-
- `string-3d-model-scale="<number>"` - Uniform scale (default `1`)
|
|
146
|
-
- `string-3d-model-center="true|false"` - Center model at origin (default `false`)
|
|
147
|
-
- `string-3d-model-fit="contain|cover"` - Fit model into element bounds (default `contain`)
|
|
148
|
-
- `string-3d-model-texture-base="<url>"` - Base path for model texture URLs
|
|
149
|
-
- `string-3d-model-textures='{"old.png":"/new.png"}'` - Remap model texture URLs
|
|
150
|
-
> Note: Model materials are only overridden when you specify material or map attributes.
|
|
151
|
-
|
|
152
|
-
### Textures & Maps
|
|
153
|
-
|
|
154
|
-
- `string-3d-map="<url>"` - Base color map
|
|
155
|
-
- `string-3d-normalMap="<url>"` - Normal map
|
|
156
|
-
- `string-3d-roughnessMap="<url>"` - Roughness map
|
|
157
|
-
- `string-3d-metalnessMap="<url>"` - Metalness map
|
|
158
|
-
- `string-3d-aoMap="<url>"` - Ambient occlusion map
|
|
159
|
-
- `string-3d-texture-flipY="true|false"` - Flip Y for all maps (default `true`)
|
|
160
|
-
- `string-3d-colorSpace="srgb|linear"` - Color space for base color map
|
|
126
|
+
- `string-3d="<type>"` - Type of 3D object: `box`, `sphere`, `plane`, `ambientLight`, `directionalLight`, etc.
|
|
127
|
+
- `string-3d="model"` - Loads a model (e.g. glTF)
|
|
128
|
+
|
|
129
|
+
### Material & Appearance
|
|
130
|
+
|
|
131
|
+
- `string-3d-material="<type>[<color>]"` - Material type: `basic`, `standard`
|
|
132
|
+
- `string-3d-color="<color>"` - Object or light color
|
|
133
|
+
- `string-3d-opacity="<number>"` - Opacity (0-1)
|
|
134
|
+
- `string-3d-metalness="<number>"` - Metalness (standard only)
|
|
135
|
+
- `string-3d-roughness="<number>"` - Roughness (standard only)
|
|
136
|
+
|
|
137
|
+
### Lighting
|
|
138
|
+
|
|
139
|
+
- `string-3d-intensity="<number>"` - Light intensity
|
|
140
|
+
|
|
141
|
+
### Models
|
|
142
|
+
|
|
143
|
+
- `string-3d-model="<url>"` - Path to model (e.g. `.gltf`, `.glb`)
|
|
144
|
+
- `string-3d-model-loader="<type>"` - Loader override per element (e.g. `gltf`)
|
|
145
|
+
- `string-3d-model-scale="<number>"` - Uniform scale (default `1`)
|
|
146
|
+
- `string-3d-model-center="true|false"` - Center model at origin (default `false`)
|
|
147
|
+
- `string-3d-model-fit="contain|cover"` - Fit model into element bounds (default `contain`)
|
|
148
|
+
- `string-3d-model-texture-base="<url>"` - Base path for model texture URLs
|
|
149
|
+
- `string-3d-model-textures='{"old.png":"/new.png"}'` - Remap model texture URLs
|
|
150
|
+
> Note: Model materials are only overridden when you specify material or map attributes.
|
|
151
|
+
|
|
152
|
+
### Textures & Maps
|
|
153
|
+
|
|
154
|
+
- `string-3d-map="<url>"` - Base color map
|
|
155
|
+
- `string-3d-normalMap="<url>"` - Normal map
|
|
156
|
+
- `string-3d-roughnessMap="<url>"` - Roughness map
|
|
157
|
+
- `string-3d-metalnessMap="<url>"` - Metalness map
|
|
158
|
+
- `string-3d-aoMap="<url>"` - Ambient occlusion map
|
|
159
|
+
- `string-3d-texture-flipY="true|false"` - Flip Y for all maps (default `true`)
|
|
160
|
+
- `string-3d-colorSpace="srgb|linear"` - Color space for base color map
|
|
161
161
|
|
|
162
162
|
## License
|
|
163
163
|
|
|
@@ -165,6 +165,6 @@ MIT © [penev.tech](https://penev.tech)
|
|
|
165
165
|
|
|
166
166
|
## Links
|
|
167
167
|
|
|
168
|
-
- [GitHub Repository](https://github.com/penev-
|
|
169
|
-
- [Issues](https://github.com/penev-
|
|
168
|
+
- [GitHub Repository](https://github.com/penev-palemiya/StringTune-3D)
|
|
169
|
+
- [Issues](https://github.com/penev-palemiya/StringTune-3D/issues)
|
|
170
170
|
- [StringTune Main Library](https://www.npmjs.com/package/@fiddle-digital/string-tune)
|