@playcanvas/web-components 0.1.10 → 0.1.12
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/LICENSE +1 -1
- package/README.md +33 -273
- package/dist/app.d.ts +4 -1
- package/dist/asset.d.ts +3 -2
- package/dist/components/camera-component.d.ts +17 -3
- package/dist/components/collision-component.d.ts +4 -3
- package/dist/components/element-component.d.ts +84 -3
- package/dist/components/light-component.d.ts +4 -3
- package/dist/components/listener-component.d.ts +4 -3
- package/dist/components/render-component.d.ts +4 -3
- package/dist/components/rigidbody-component.d.ts +5 -4
- package/dist/components/screen-component.d.ts +4 -3
- package/dist/components/script-component.d.ts +4 -3
- package/dist/components/sound-component.d.ts +4 -3
- package/dist/components/sound-slot.d.ts +2 -2
- package/dist/components/splat-component.d.ts +36 -0
- package/dist/entity.d.ts +3 -2
- package/dist/index.d.ts +2 -2
- package/dist/material.d.ts +3 -2
- package/dist/model.d.ts +6 -5
- package/dist/module.d.ts +3 -2
- package/dist/pwc.cjs +284 -87
- package/dist/pwc.cjs.map +1 -1
- package/dist/pwc.js +284 -87
- package/dist/pwc.js.map +1 -1
- package/dist/pwc.min.js +1 -1
- package/dist/pwc.min.js.map +1 -1
- package/dist/pwc.mjs +284 -87
- package/dist/pwc.mjs.map +1 -1
- package/dist/scene.d.ts +3 -2
- package/dist/sky.d.ts +64 -0
- package/package.json +23 -23
- package/src/app.ts +14 -10
- package/src/asset.ts +3 -2
- package/src/components/camera-component.ts +31 -3
- package/src/components/collision-component.ts +4 -3
- package/src/components/element-component.ts +84 -3
- package/src/components/light-component.ts +4 -3
- package/src/components/listener-component.ts +4 -3
- package/src/components/render-component.ts +4 -3
- package/src/components/rigidbody-component.ts +5 -4
- package/src/components/screen-component.ts +4 -3
- package/src/components/script-component.ts +4 -3
- package/src/components/sound-component.ts +4 -3
- package/src/components/sound-slot.ts +2 -2
- package/src/components/{gsplat-component.ts → splat-component.ts} +17 -8
- package/src/entity.ts +3 -2
- package/src/index.ts +2 -2
- package/src/material.ts +6 -5
- package/src/model.ts +8 -7
- package/src/module.ts +3 -2
- package/src/scene.ts +3 -2
- package/src/sky.ts +64 -0
- package/dist/components/gsplat-component.d.ts +0 -27
- package/dist/fog.d.ts +0 -28
- package/src/fog.ts +0 -121
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
[](https://github.com/playcanvas/web-components/blob/main/LICENSE)
|
|
6
6
|
[](https://github.com/playcanvas/web-components/actions/workflows/deploy.yml)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
| [User Guide](https://developer.playcanvas.com/user-manual/engine/web-components) | [API Reference](https://api.playcanvas.com/modules/EngineWebComponents.html) | [Examples](https://playcanvas.github.io/web-components/examples) | [Forum](https://forum.playcanvas.com/) | [Discord](https://discord.gg/RSaMRzg) |
|
|
9
|
+
|
|
10
|
+
PlayCanvas Web Components are a set of custom HTML elements for building 3D interactive web apps. Using the declarative nature of HTML makes it both easy and fun to incorporate 3D into your website. Check out this simple example:
|
|
9
11
|
|
|
10
12
|
```html
|
|
11
13
|
<!-- A lit sphere -->
|
|
@@ -30,293 +32,51 @@ PlayCanvas Web Components are a set of custom HTML elements for building 3D inte
|
|
|
30
32
|
|
|
31
33
|
See PlayCanvas Web Components in action here: https://playcanvas.github.io/web-components/examples
|
|
32
34
|
|
|
33
|
-
## Usage
|
|
34
|
-
|
|
35
|
-
If you are using a bundler (e.g. Rollup), you can install PlayCanvas Web Components and the PlayCanvas Engine using NPM:
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
npm install playcanvas @playcanvas/web-components --save-dev
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Or you can include it directly in your HTML file from a CDN.
|
|
42
|
-
|
|
43
|
-
ES Modules:
|
|
44
|
-
|
|
45
|
-
```html
|
|
46
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@playcanvas/web-components@0.1.9/dist/pwc.mjs"></script>
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
UMD:
|
|
50
|
-
|
|
51
|
-
```html
|
|
52
|
-
<script src="https://cdn.jsdelivr.net/npm/@playcanvas/web-components@0.1.9"></script>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
## Tag Reference 📖
|
|
56
|
-
|
|
57
|
-
Table of contents:
|
|
58
|
-
|
|
59
|
-
- [pc-app](#pc-app)
|
|
60
|
-
- [pc-asset](#pc-asset)
|
|
61
|
-
- [pc-camera](#pc-camera)
|
|
62
|
-
- [pc-collision](#pc-collision)
|
|
63
|
-
- [pc-element](#pc-element)
|
|
64
|
-
- [pc-entity](#pc-entity)
|
|
65
|
-
- [pc-light](#pc-light)
|
|
66
|
-
- [pc-listener](#pc-listener)
|
|
67
|
-
- [pc-module](#pc-module)
|
|
68
|
-
- [pc-render](#pc-render)
|
|
69
|
-
- [pc-rigidbody](#pc-rigidbody)
|
|
70
|
-
- [pc-scene](#pc-scene)
|
|
71
|
-
- [pc-script](#pc-script)
|
|
72
|
-
- [pc-scripts](#pc-scripts)
|
|
73
|
-
- [pc-sky](#pc-sky)
|
|
74
|
-
- [pc-screen](#pc-screen)
|
|
75
|
-
- [pc-sound](#pc-sound)
|
|
76
|
-
- [pc-sounds](#pc-sounds)
|
|
77
|
-
- [pc-splat](#pc-splat)
|
|
78
|
-
|
|
79
|
-
### pc-app
|
|
80
|
-
|
|
81
|
-
The `pc-app` tag is the root element for your PlayCanvas application. It is used to initialize the PlayCanvas application and provide a container for your scene.
|
|
82
|
-
|
|
83
|
-
| Attribute | Description |
|
|
84
|
-
| --- | --- |
|
|
85
|
-
| `alpha` | Boolean attribute. Determines whether the application allocates an alpha channel in the frame buffer. Defaults to `true`. |
|
|
86
|
-
| `antialias` | Boolean attribute. Determines whether the application uses anti-aliasing. Defaults to `true`. |
|
|
87
|
-
| `depth` | Boolean attribute. Determines whether the application allocates a depth buffer. Defaults to `true`. |
|
|
88
|
-
| `high-resolution` | Boolean attribute. Determines whether the application renders using physical resolution or CSS resolution. Defaults to `true`. |
|
|
89
|
-
| `stencil` | Boolean attribute. Determines whether the application allocates a stencil buffer. Defaults to `true`. |
|
|
90
|
-
|
|
91
|
-
### pc-asset
|
|
92
|
-
|
|
93
|
-
The `pc-asset` tag is used to define an asset. It must be a direct child of `pc-app`.
|
|
94
|
-
|
|
95
|
-
| Attribute | Description |
|
|
96
|
-
| --- | --- |
|
|
97
|
-
| `id` | The ID of the asset. This is used to reference the asset in scripts. |
|
|
98
|
-
| `src` | The path to the asset. |
|
|
99
|
-
| `preload` | Valueless attribute. If present, the asset is loaded immediately. |
|
|
100
|
-
| `type` | The type of asset. If not specified, the type is inferred from the file extension. Can be: `audio`, `binary`, `css`, `container`, `gsplat`, `html`, `json`, `script`, `shader`, `text`, `texture`. |
|
|
101
|
-
|
|
102
|
-
### pc-camera
|
|
103
|
-
|
|
104
|
-
The `pc-camera` tag is used to define a camera component. It must be a direct child of an `pc-entity`.
|
|
105
|
-
|
|
106
|
-
| Attribute | Description |
|
|
107
|
-
| --- | --- |
|
|
108
|
-
| `clear-color` | The background color of the camera. Can be a space-separated list of R, G, B, and A values or a hex color code. If unspecified, `0.75,0.75,0.75,1` is used. |
|
|
109
|
-
| `clear-color-buffer` | Boolean attribute. Controls whether the camera clears the color buffer. If unspecified, the color buffer is cleared. |
|
|
110
|
-
| `clear-depth-buffer` | Boolean attribute. Controls whether the camera clears the depth buffer. If unspecified, the depth buffer is cleared. |
|
|
111
|
-
| `clear-stencil-buffer` | Boolean attribute. Controls whether the camera clears the stencil buffer. If unspecified, the stencil buffer is cleared. |
|
|
112
|
-
| `cull-faces` | Boolean attribute. Controls whether the camera culls faces. If unspecified, faces are culled. |
|
|
113
|
-
| `far-clip` | The far clipping plane of the camera. If unspecified, `1000` is used. |
|
|
114
|
-
| `flip-faces` | Boolean attribute. Controls whether the camera flips faces. If unspecified, faces are not flipped. |
|
|
115
|
-
| `fov` | The field of view of the camera. If unspecified, `45` is used. |
|
|
116
|
-
| `frustum-culling` | Boolean attribute. Controls whether the camera uses frustum culling. If unspecified, frustum culling is used. |
|
|
117
|
-
| `near-clip` | The near clipping plane of the camera. If unspecified, `0.1` is used. |
|
|
118
|
-
| `orthographic` | Valueless attribute. If present, the camera uses an orthographic projection. If unspecified, the camera uses a perspective projection. |
|
|
119
|
-
| `ortho-height` | The height of the orthographic projection. If unspecified, `10` is used. |
|
|
120
|
-
| `priority` | The priority of the camera. If unspecified, `0` is used. |
|
|
121
|
-
| `rect` | The viewport rectangle of the camera. Specified as a space-separated list of X, Y, Width, and Height values. If unspecified, `0 0 1 1` is used. |
|
|
122
|
-
| `scissor-rect` | The scissor rectangle of the camera. Specified as a space-separated list of X, Y, Width, and Height values. If not specified, `0 0 1 1` is used. |
|
|
123
|
-
|
|
124
|
-
### pc-collision
|
|
125
|
-
|
|
126
|
-
The `pc-collision` tag is used to define a collision component. It must be a direct child of a `pc-entity`.
|
|
127
|
-
|
|
128
|
-
| Attribute | Description |
|
|
129
|
-
| --- | --- |
|
|
130
|
-
| `axis` | The axis of the collision component. If not specified, `1` is used (Y-axis). |
|
|
131
|
-
| `convex-hull` | Valueless attribute. If present, the collision component uses a convex hull. |
|
|
132
|
-
| `enabled` | Enabled state of the collision component. If not specified, `true` is used. |
|
|
133
|
-
| `half-extents` | The half-extents of the collision component. Specified as a space-separated list of X, Y, and Z values. If not specified, `0.5 0.5 0.5` is used. |
|
|
134
|
-
| `height` | The height of the collision component. If not specified, `2` is used. |
|
|
135
|
-
| `radius` | The radius of the collision component. If not specified, `0.5` is used. |
|
|
136
|
-
| `type` | The type of collision component. Can be `box`, `capsule`, `cone`, `cylinder` or `sphere`. |
|
|
137
|
-
|
|
138
|
-
### pc-element
|
|
35
|
+
## Usage
|
|
139
36
|
|
|
140
|
-
|
|
37
|
+
Please see the [Getting Started Guide](https://developer.playcanvas.com/user-manual/engine/web-components/getting-started) for installation and usage instructions.
|
|
141
38
|
|
|
142
|
-
|
|
143
|
-
| --- | --- |
|
|
144
|
-
| `anchor` | The anchor of the element component. Specified as a space-separated list of X, Y, Z, and W values. If not specified, `0 0 0 1` is used. |
|
|
145
|
-
| `asset` | A string that should match the `id` of a `pc-asset` tag that has a type of `font`. |
|
|
146
|
-
| `auto-width` | Valueless attribute. If present, the element component automatically adjusts its width. |
|
|
147
|
-
| `color` | The color of the element component. Can be a space-separated list of R, G, B, and A values or a hex color code. If not specified, `1 1 1 1` is used. |
|
|
148
|
-
| `font-size` | The font size of the element component. If not specified, `16` is used. |
|
|
149
|
-
| `line-height` | The line height of the element component. If not specified, `1.2` is used. |
|
|
150
|
-
| `pivot` | The pivot of the element component. Specified as a space-separated list of X and Y values. If not specified, `0.5 0.5` is used. |
|
|
151
|
-
| `text` | The text of the element component. |
|
|
152
|
-
| `type` | The type of element component. Can be `group`, `image` or `text`. If not specified, `group` is used. |
|
|
153
|
-
| `width` | The width of the element component. If not specified, `0` is used. |
|
|
154
|
-
| `wrap-lines` | Valueless attribute. If present, the element component wraps lines. |
|
|
39
|
+
## Development
|
|
155
40
|
|
|
156
|
-
###
|
|
41
|
+
### Setting Up Local Development
|
|
157
42
|
|
|
158
|
-
|
|
43
|
+
1. Clone the repository:
|
|
159
44
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
| `position` | The position of the entity. Specified as a space-separated list of X, Y, and Z values. If not specified, `0 0 0` is used. |
|
|
165
|
-
| `rotation` | The rotation of the entity. Specified as a space-separated list of X, Y, and Z Euler angles in degrees. If not specified, `0 0 0` is used. |
|
|
166
|
-
| `scale` | The scale of the entity. Specified as a space-separated list of X, Y, and Z values. If not specified, `1 1 1` is used. |
|
|
167
|
-
| `tags` | A space-separated list of tags for the entity. |
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/playcanvas/web-components.git
|
|
47
|
+
cd web-components
|
|
48
|
+
```
|
|
168
49
|
|
|
169
|
-
|
|
50
|
+
2. Install dependencies:
|
|
170
51
|
|
|
171
|
-
|
|
52
|
+
```bash
|
|
53
|
+
npm install
|
|
54
|
+
```
|
|
172
55
|
|
|
173
|
-
|
|
174
|
-
| --- | --- |
|
|
175
|
-
| `color` | The color of the light. Can be a space-separated list of R, G, B values or a hex color code. If not specified, `1 1 1` is used. |
|
|
176
|
-
| `cast-shadows` | Valueless attribute. If present, the light casts shadows. |
|
|
177
|
-
| `inner-cone-angle` | The angle of the light's inner cone. If not specified, `40` is used. |
|
|
178
|
-
| `intensity` | The intensity of the light. If not specified, `1` is used. |
|
|
179
|
-
| `normal-offset-bias` | The bias of the light's normal offset. If not specified, `0.05` is used. |
|
|
180
|
-
| `outer-cone-angle` | The angle of the light's outer cone. If not specified, `45` is used. |
|
|
181
|
-
| `range` | The range of the light. If not specified, `10` is used. |
|
|
182
|
-
| `shadow-bias` | The bias of the light's shadows. If not specified, `0.2` is used. |
|
|
183
|
-
| `shadow-distance` | The distance at which the light's shadows are no longer rendered. If not specified, `16` is used. |
|
|
184
|
-
| `type` | The type of light. Can be `directional`, `point` or `omni`. |
|
|
56
|
+
3. Build the library in watch mode and start the development server:
|
|
185
57
|
|
|
186
|
-
|
|
58
|
+
```bash
|
|
59
|
+
npm run dev
|
|
60
|
+
```
|
|
187
61
|
|
|
188
|
-
|
|
62
|
+
4. Open http://localhost:3000/examples/ in your browser to see the examples.
|
|
189
63
|
|
|
190
|
-
###
|
|
64
|
+
### Building
|
|
191
65
|
|
|
192
|
-
|
|
66
|
+
To build the library:
|
|
193
67
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
| `glue` | The path to the glue code for the module. |
|
|
198
|
-
| `wasm` | The path to the WASM file for the module. |
|
|
199
|
-
| `fallback` | The path to the fallback (asm.js) code for the module. |
|
|
200
|
-
|
|
201
|
-
### pc-render
|
|
202
|
-
|
|
203
|
-
The `pc-render` tag is used to define a render component that render a 3D primitive. It must be a direct child of a `pc-entity`.
|
|
204
|
-
|
|
205
|
-
| Attribute | Description |
|
|
206
|
-
| --- | --- |
|
|
207
|
-
| `type` | The type of render component. Can be `box`, `capsule`, `cone`, `cylinder`, `plane` or `sphere`. |
|
|
208
|
-
| `cast-shadows` | Valueless attribute. If present, the render component casts shadows. |
|
|
209
|
-
| `receive-shadows` | Valueless attribute. If present, the render component receives shadows. |
|
|
210
|
-
|
|
211
|
-
### pc-rigidbody
|
|
212
|
-
|
|
213
|
-
The `pc-rigidbody` tag is used to define a rigidbody component. It must be a direct child of a `pc-entity`.
|
|
214
|
-
|
|
215
|
-
| Attribute | Description |
|
|
216
|
-
| --- | --- |
|
|
217
|
-
| `angular-damping` | The angular damping of the rigidbody. If not specified, `0` is used. |
|
|
218
|
-
| `angular-factor` | The angular factor of the rigidbody. Specified as a space-separated list of X, Y, and Z values. If not specified, `1 1 1` is used. |
|
|
219
|
-
| `friction` | The friction of the rigidbody. If not specified, `0.5` is used. |
|
|
220
|
-
| `linear-damping` | The linear damping of the rigidbody. If not specified, `0` is used. |
|
|
221
|
-
| `linear-factor` | The linear factor of the rigidbody. Specified as a space-separated list of X, Y, and Z values. If not specified, `1 1 1` is used. |
|
|
222
|
-
| `mass` | The mass of the rigidbody. If not specified, `1` is used. |
|
|
223
|
-
| `restitution` | The restitution of the rigidbody. If not specified, `0` is used. |
|
|
224
|
-
| `rolling-friction` | The rolling friction of the rigidbody. If not specified, `0` is used. |
|
|
225
|
-
| `type` | The type of rigidbody component. Can be `static`, `kinematic` or `dynamic`. |
|
|
226
|
-
|
|
227
|
-
### pc-scene
|
|
228
|
-
|
|
229
|
-
The `pc-scene` tag is used to define the scene. It must be a direct child of `pc-app`.
|
|
230
|
-
|
|
231
|
-
| Attribute | Description |
|
|
232
|
-
| --- | --- |
|
|
233
|
-
| `fog` | The type of fog to use. Can be `linear`, `exp`, or `exp2`. |
|
|
234
|
-
| `fog-color` | The color of the fog. Can be a CSS color string or a hex color code. |
|
|
235
|
-
| `fog-start` | The start distance of the fog. |
|
|
236
|
-
| `fog-end` | The end distance of the fog. |
|
|
237
|
-
| `fog-density` | The density of the fog. |
|
|
238
|
-
|
|
239
|
-
### pc-screen
|
|
240
|
-
|
|
241
|
-
The `pc-screen` tag is used to define a screen component. It must be a direct child of a `pc-entity`.
|
|
242
|
-
|
|
243
|
-
| Attribute | Description |
|
|
244
|
-
| --- | --- |
|
|
245
|
-
| `blend` | Valueless attribute. If present, the screen component blends. |
|
|
246
|
-
| `priority` | The priority of the screen component. Must be an integer between `0` and `255`. If not specified, `0` is used. |
|
|
247
|
-
| `reference-resolution` | The reference resolution of the screen component. Specified as a space-separated list of Width and Height values. If not specified, `640 320` is used. |
|
|
248
|
-
| `resolution` | The resolution of the screen component. Specified as a space-separated list of Width and Height values. If not specified, `640 320` is used. |
|
|
249
|
-
| `scale-blend` | The scale blend of the screen component. Must be a number between `0` and `1`. If not specified, `0.5` is used. |
|
|
250
|
-
| `screen-space` | Valueless attribute. If present, the screen component is in screen space. |
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
### pc-script
|
|
254
|
-
|
|
255
|
-
The `pc-script` tag is used to define a script. It must be a direct child of a `pc-scripts` component.
|
|
256
|
-
|
|
257
|
-
| Attribute | Description |
|
|
258
|
-
| --- | --- |
|
|
259
|
-
| `attributes` | A JSON string of attributes for the script. |
|
|
260
|
-
| `enabled` | Enabled state of the script. If not specified, `true` is used. |
|
|
261
|
-
| `name` | The name of the script. |
|
|
262
|
-
|
|
263
|
-
### pc-scripts
|
|
264
|
-
|
|
265
|
-
The `pc-scripts` tag is used to define a scripts component. It must be a direct child of a `pc-entity`.
|
|
266
|
-
|
|
267
|
-
| Attribute | Description |
|
|
268
|
-
| --- | --- |
|
|
269
|
-
| `enabled` | Enabled state of the scripts component. If not specified, `true` is used. |
|
|
270
|
-
|
|
271
|
-
### pc-sky
|
|
272
|
-
|
|
273
|
-
The `pc-sky` tag is used to define a sky component. It must be a direct child of a `pc-scene`.
|
|
274
|
-
|
|
275
|
-
| Attribute | Description |
|
|
276
|
-
| --- | --- |
|
|
277
|
-
| `asset` | A string that should match the `id` of a `pc-asset` tag that has a type of `texture`. |
|
|
278
|
-
| `center` | The center of the sky. Specified as a space-separated list of X, Y, and Z values in the range 0 to 1. If not specified, `0 0.01 0` is used. |
|
|
279
|
-
| `intensity` | The intensity of the sky. If not specified, `1` is used. |
|
|
280
|
-
| `level` | The mipmap level used to render the sky. If not specified, `0` is used (base mip level). |
|
|
281
|
-
| `rotation` | The rotation of the sky. Specified as a space-separated list of X, Y, and Z values. If not specified, `0 0 0` is used. |
|
|
282
|
-
| `scale` | The scale of the sky. Specified as a space-separated list of X, Y, and Z values. If not specified, `100 100 100` is used. |
|
|
283
|
-
| `type` | The type of sky component. Can be `box`, `dome`, `infinite` or `none`. |
|
|
284
|
-
|
|
285
|
-
### pc-sound
|
|
286
|
-
|
|
287
|
-
The `pc-sound` tag is used to define a sound. It must be a direct child of a `pc-sounds`.
|
|
288
|
-
|
|
289
|
-
| Attribute | Description |
|
|
290
|
-
| --- | --- |
|
|
291
|
-
| `asset` | A string that should match the `id` of a `pc-asset` tag that has a type of `audio`. |
|
|
292
|
-
| `auto-play` | Valueless attribute. If present, the sound slot plays automatically. |
|
|
293
|
-
| `duration` | The duration of the sound slot. |
|
|
294
|
-
| `loop` | Valueless attribute. If present, the sound slot loops. |
|
|
295
|
-
| `name` | The name of the sound slot. |
|
|
296
|
-
| `overlap` | Valueless attribute. If present, the sound slot overlaps. |
|
|
297
|
-
| `pitch` | The pitch of the sound slot. If not specified, `1` is used. |
|
|
298
|
-
| `start-time` | The start time of the sound slot. If not specified, `0` is used. |
|
|
299
|
-
| `volume` | The volume of the sound slot. If not specified, `1` is used. |
|
|
300
|
-
|
|
301
|
-
### pc-sounds
|
|
68
|
+
```bash
|
|
69
|
+
npm run build
|
|
70
|
+
```
|
|
302
71
|
|
|
303
|
-
The
|
|
72
|
+
The built files will be available in the `dist` directory.
|
|
304
73
|
|
|
305
|
-
|
|
306
|
-
| --- | --- |
|
|
307
|
-
| `distance-model` | The distance model of the sound. Can be `exponential`, `inverse` or `linear`. If not specified, `linear` is used. |
|
|
308
|
-
| `pitch` | The pitch of the sound. If not specified, `1` is used. |
|
|
309
|
-
| `max-distance` | The maximum distance from the listener at which audio falloff stops. If not specified, `10000` is used. |
|
|
310
|
-
| `positional` | Valueless attribute. If present, the sound is positional. |
|
|
311
|
-
| `ref-distance` | The distance from the listener at which the volume will be at full volume. If not specified, `1` is used. |
|
|
312
|
-
| `roll-off-factor` | The factor used in the falloff equation. If not specified, `1` is used. |
|
|
313
|
-
| `volume` | The volume of the sound. If not specified, `1` is used. |
|
|
74
|
+
### API Documentation
|
|
314
75
|
|
|
315
|
-
|
|
76
|
+
To generate API documentation:
|
|
316
77
|
|
|
317
|
-
|
|
78
|
+
```bash
|
|
79
|
+
npm run docs
|
|
80
|
+
```
|
|
318
81
|
|
|
319
|
-
|
|
320
|
-
| --- | --- |
|
|
321
|
-
| `asset` | A string that should match the `id` of a `pc-asset` tag that has a type of `gsplat`. |
|
|
322
|
-
| `enabled` | Enabled state of the splat component. If not specified, `true` is used. |
|
|
82
|
+
The documentation will be generated in the `docs` directory.
|
package/dist/app.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Application } from 'playcanvas';
|
|
2
2
|
import { AsyncElement } from './async-element';
|
|
3
3
|
/**
|
|
4
|
-
* The
|
|
4
|
+
* The AppElement interface provides properties and methods for manipulating
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-app/ | `<pc-app>`} elements.
|
|
6
|
+
* The AppElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
5
8
|
*/
|
|
6
9
|
declare class AppElement extends AsyncElement {
|
|
7
10
|
/**
|
package/dist/asset.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { Asset } from 'playcanvas';
|
|
2
2
|
/**
|
|
3
3
|
* The AssetElement interface provides properties and methods for manipulating
|
|
4
|
-
* `<pc-asset>` elements.
|
|
5
|
-
*
|
|
4
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-asset/ | `<pc-asset>`} elements.
|
|
5
|
+
* The AssetElement interface also inherits the properties and methods of the
|
|
6
|
+
* {@link HTMLElement} interface.
|
|
6
7
|
*/
|
|
7
8
|
declare class AssetElement extends HTMLElement {
|
|
8
9
|
private _preload;
|
|
@@ -2,8 +2,9 @@ import { CameraComponent, Color, Vec4 } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The CameraComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* `<pc-camera>` elements.
|
|
6
|
-
*
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-camera/ | `<pc-camera>`} elements.
|
|
6
|
+
* The CameraComponentElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
7
8
|
*
|
|
8
9
|
* @category Components
|
|
9
10
|
*/
|
|
@@ -18,6 +19,7 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
18
19
|
private _fov;
|
|
19
20
|
private _frustumCulling;
|
|
20
21
|
private _gamma;
|
|
22
|
+
private _horizontalFov;
|
|
21
23
|
private _nearClip;
|
|
22
24
|
private _orthographic;
|
|
23
25
|
private _orthoHeight;
|
|
@@ -38,6 +40,7 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
38
40
|
fov: number;
|
|
39
41
|
frustumCulling: boolean;
|
|
40
42
|
gammaCorrection: number;
|
|
43
|
+
horizontalFov: boolean;
|
|
41
44
|
nearClip: number;
|
|
42
45
|
orthographic: boolean;
|
|
43
46
|
orthoHeight: number;
|
|
@@ -50,7 +53,7 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
50
53
|
startXr(type: 'immersive-ar' | 'immersive-vr', space: 'bounded-floor' | 'local' | 'local-floor' | 'unbounded' | 'viewer'): void;
|
|
51
54
|
endXr(): void;
|
|
52
55
|
/**
|
|
53
|
-
* Gets the camera component.
|
|
56
|
+
* Gets the underlying PlayCanvas camera component.
|
|
54
57
|
* @returns The camera component.
|
|
55
58
|
*/
|
|
56
59
|
get component(): CameraComponent | null;
|
|
@@ -154,6 +157,17 @@ declare class CameraComponentElement extends ComponentElement {
|
|
|
154
157
|
* @returns The gamma correction.
|
|
155
158
|
*/
|
|
156
159
|
get gamma(): 'none' | 'srgb';
|
|
160
|
+
/**
|
|
161
|
+
* Sets whether the camera's field of view (fov) is horizontal or vertical. Defaults to false
|
|
162
|
+
* (meaning it is vertical be default).
|
|
163
|
+
* @param value - Whether the camera's field of view is horizontal.
|
|
164
|
+
*/
|
|
165
|
+
set horizontalFov(value: boolean);
|
|
166
|
+
/**
|
|
167
|
+
* Gets whether the camera's field of view (fov) is horizontal or vertical.
|
|
168
|
+
* @returns Whether the camera's field of view is horizontal.
|
|
169
|
+
*/
|
|
170
|
+
get horizontalFov(): boolean;
|
|
157
171
|
/**
|
|
158
172
|
* Sets the near clip distance of the camera.
|
|
159
173
|
* @param value - The near clip distance.
|
|
@@ -2,8 +2,9 @@ import { CollisionComponent, Quat, Vec3 } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The CollisionComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* `<pc-collision>` elements.
|
|
6
|
-
* and methods of the
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-collision/ | `<pc-collision>`} elements.
|
|
6
|
+
* The CollisionComponentElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
7
8
|
*
|
|
8
9
|
* @category Components
|
|
9
10
|
*/
|
|
@@ -29,7 +30,7 @@ declare class CollisionComponentElement extends ComponentElement {
|
|
|
29
30
|
type: string;
|
|
30
31
|
};
|
|
31
32
|
/**
|
|
32
|
-
* Gets the collision component.
|
|
33
|
+
* Gets the underlying PlayCanvas collision component.
|
|
33
34
|
* @returns The collision component.
|
|
34
35
|
*/
|
|
35
36
|
get component(): CollisionComponent | null;
|
|
@@ -2,8 +2,9 @@ import { Color, ElementComponent, Vec2, Vec4 } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The ElementComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* `<pc-element>` elements.
|
|
6
|
-
*
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-element/ | `<pc-element>`} elements.
|
|
6
|
+
* The ElementComponentElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
7
8
|
*
|
|
8
9
|
* @category Components
|
|
9
10
|
*/
|
|
@@ -36,25 +37,89 @@ declare class ElementComponentElement extends ComponentElement {
|
|
|
36
37
|
wrapLines: boolean;
|
|
37
38
|
};
|
|
38
39
|
/**
|
|
39
|
-
* Gets the element component.
|
|
40
|
+
* Gets the underlying PlayCanvas element component.
|
|
40
41
|
* @returns The element component.
|
|
41
42
|
*/
|
|
42
43
|
get component(): ElementComponent | null;
|
|
44
|
+
/**
|
|
45
|
+
* Sets the anchor of the element component.
|
|
46
|
+
* @param value - The anchor.
|
|
47
|
+
*/
|
|
43
48
|
set anchor(value: Vec4);
|
|
49
|
+
/**
|
|
50
|
+
* Gets the anchor of the element component.
|
|
51
|
+
* @returns The anchor.
|
|
52
|
+
*/
|
|
44
53
|
get anchor(): Vec4;
|
|
54
|
+
/**
|
|
55
|
+
* Sets the id of the `pc-asset` to use for the font.
|
|
56
|
+
* @param value - The asset ID.
|
|
57
|
+
*/
|
|
45
58
|
set asset(value: string);
|
|
59
|
+
/**
|
|
60
|
+
* Gets the id of the `pc-asset` to use for the font.
|
|
61
|
+
* @returns The asset ID.
|
|
62
|
+
*/
|
|
46
63
|
get asset(): string;
|
|
64
|
+
/**
|
|
65
|
+
* Sets whether the element component should automatically adjust its width.
|
|
66
|
+
* @param value - Whether to automatically adjust the width.
|
|
67
|
+
*/
|
|
47
68
|
set autoWidth(value: boolean);
|
|
69
|
+
/**
|
|
70
|
+
* Gets whether the element component should automatically adjust its width.
|
|
71
|
+
* @returns Whether to automatically adjust the width.
|
|
72
|
+
*/
|
|
48
73
|
get autoWidth(): boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Sets the color of the element component.
|
|
76
|
+
* @param value - The color.
|
|
77
|
+
*/
|
|
49
78
|
set color(value: Color);
|
|
79
|
+
/**
|
|
80
|
+
* Gets the color of the element component.
|
|
81
|
+
* @returns The color.
|
|
82
|
+
*/
|
|
50
83
|
get color(): Color;
|
|
84
|
+
/**
|
|
85
|
+
* Sets the font size of the element component.
|
|
86
|
+
* @param value - The font size.
|
|
87
|
+
*/
|
|
51
88
|
set fontSize(value: number);
|
|
89
|
+
/**
|
|
90
|
+
* Gets the font size of the element component.
|
|
91
|
+
* @returns The font size.
|
|
92
|
+
*/
|
|
52
93
|
get fontSize(): number;
|
|
94
|
+
/**
|
|
95
|
+
* Sets the line height of the element component.
|
|
96
|
+
* @param value - The line height.
|
|
97
|
+
*/
|
|
53
98
|
set lineHeight(value: number);
|
|
99
|
+
/**
|
|
100
|
+
* Gets the line height of the element component.
|
|
101
|
+
* @returns The line height.
|
|
102
|
+
*/
|
|
54
103
|
get lineHeight(): number;
|
|
104
|
+
/**
|
|
105
|
+
* Sets the pivot of the element component.
|
|
106
|
+
* @param value - The pivot.
|
|
107
|
+
*/
|
|
55
108
|
set pivot(value: Vec2);
|
|
109
|
+
/**
|
|
110
|
+
* Gets the pivot of the element component.
|
|
111
|
+
* @returns The pivot.
|
|
112
|
+
*/
|
|
56
113
|
get pivot(): Vec2;
|
|
114
|
+
/**
|
|
115
|
+
* Sets the text of the element component.
|
|
116
|
+
* @param value - The text.
|
|
117
|
+
*/
|
|
57
118
|
set text(value: string);
|
|
119
|
+
/**
|
|
120
|
+
* Gets the text of the element component.
|
|
121
|
+
* @returns The text.
|
|
122
|
+
*/
|
|
58
123
|
get text(): string;
|
|
59
124
|
/**
|
|
60
125
|
* Sets the type of the element component.
|
|
@@ -66,9 +131,25 @@ declare class ElementComponentElement extends ComponentElement {
|
|
|
66
131
|
* @returns The type.
|
|
67
132
|
*/
|
|
68
133
|
get type(): 'group' | 'image' | 'text';
|
|
134
|
+
/**
|
|
135
|
+
* Sets the width of the element component.
|
|
136
|
+
* @param value - The width.
|
|
137
|
+
*/
|
|
69
138
|
set width(value: number);
|
|
139
|
+
/**
|
|
140
|
+
* Gets the width of the element component.
|
|
141
|
+
* @returns The width.
|
|
142
|
+
*/
|
|
70
143
|
get width(): number;
|
|
144
|
+
/**
|
|
145
|
+
* Sets whether the element component should wrap lines.
|
|
146
|
+
* @param value - Whether to wrap lines.
|
|
147
|
+
*/
|
|
71
148
|
set wrapLines(value: boolean);
|
|
149
|
+
/**
|
|
150
|
+
* Gets whether the element component should wrap lines.
|
|
151
|
+
* @returns Whether to wrap lines.
|
|
152
|
+
*/
|
|
72
153
|
get wrapLines(): boolean;
|
|
73
154
|
static get observedAttributes(): string[];
|
|
74
155
|
attributeChangedCallback(name: string, _oldValue: string, newValue: string): void;
|
|
@@ -2,8 +2,9 @@ import { Color, LightComponent } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The LightComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* `<pc-light>` elements.
|
|
6
|
-
*
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-light/ | `<pc-light>`} elements.
|
|
6
|
+
* The LightComponentElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
7
8
|
*
|
|
8
9
|
* @category Components
|
|
9
10
|
*/
|
|
@@ -41,7 +42,7 @@ declare class LightComponentElement extends ComponentElement {
|
|
|
41
42
|
vsmBias: number;
|
|
42
43
|
};
|
|
43
44
|
/**
|
|
44
|
-
* Gets the light component.
|
|
45
|
+
* Gets the underlying PlayCanvas light component.
|
|
45
46
|
* @returns The light component.
|
|
46
47
|
*/
|
|
47
48
|
get component(): LightComponent | null;
|
|
@@ -2,8 +2,9 @@ import { AudioListenerComponent } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The ListenerComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* `<pc-listener>` elements.
|
|
6
|
-
* and methods of the
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-listener/ | `<pc-listener>`} elements.
|
|
6
|
+
* The ListenerComponentElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
7
8
|
*
|
|
8
9
|
* @category Components
|
|
9
10
|
*/
|
|
@@ -11,7 +12,7 @@ declare class ListenerComponentElement extends ComponentElement {
|
|
|
11
12
|
/** @ignore */
|
|
12
13
|
constructor();
|
|
13
14
|
/**
|
|
14
|
-
* Gets the audio listener component.
|
|
15
|
+
* Gets the underlying PlayCanvas audio listener component.
|
|
15
16
|
* @returns The audio listener component.
|
|
16
17
|
*/
|
|
17
18
|
get component(): AudioListenerComponent | null;
|
|
@@ -2,8 +2,9 @@ import { RenderComponent, StandardMaterial } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The RenderComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* `<pc-render>` elements.
|
|
6
|
-
*
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-render/ | `<pc-render>`} elements.
|
|
6
|
+
* The RenderComponentElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
7
8
|
*
|
|
8
9
|
* @category Components
|
|
9
10
|
*/
|
|
@@ -21,7 +22,7 @@ declare class RenderComponentElement extends ComponentElement {
|
|
|
21
22
|
receiveShadows: boolean;
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
24
|
-
* Gets the render component.
|
|
25
|
+
* Gets the underlying PlayCanvas render component.
|
|
25
26
|
* @returns The render component.
|
|
26
27
|
*/
|
|
27
28
|
get component(): RenderComponent | null;
|
|
@@ -2,8 +2,9 @@ import { RigidBodyComponent, Vec3 } from 'playcanvas';
|
|
|
2
2
|
import { ComponentElement } from './component';
|
|
3
3
|
/**
|
|
4
4
|
* The RigidBodyComponentElement interface provides properties and methods for manipulating
|
|
5
|
-
* `<pc-rigidbody>` elements.
|
|
6
|
-
* and methods of the
|
|
5
|
+
* {@link https://developer.playcanvas.com/user-manual/engine/web-components/tags/pc-rigidbody/ | `<pc-rigidbody>`} elements.
|
|
6
|
+
* The RigidBodyComponentElement interface also inherits the properties and methods of the
|
|
7
|
+
* {@link HTMLElement} interface.
|
|
7
8
|
*
|
|
8
9
|
* @category Components
|
|
9
10
|
*/
|
|
@@ -58,8 +59,8 @@ declare class RigidBodyComponentElement extends ComponentElement {
|
|
|
58
59
|
type: string;
|
|
59
60
|
};
|
|
60
61
|
/**
|
|
61
|
-
* Gets the
|
|
62
|
-
* @returns The
|
|
62
|
+
* Gets the underlying PlayCanvas rigidbody component.
|
|
63
|
+
* @returns The rigidbody component.
|
|
63
64
|
*/
|
|
64
65
|
get component(): RigidBodyComponent | null;
|
|
65
66
|
set angularDamping(value: number);
|