|
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 | | -| [Examples](https://playcanvas.github.io/web-components/examples) | [API Reference](https://api.playcanvas.com/modules/EngineWebComponents.html) | [Forum](https://forum.playcanvas.com/) | [Discord](https://discord.gg/RSaMRzg) | |
| 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 | 9 |
|
10 | 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. |
11 | 11 |
|
@@ -83,272 +83,3 @@ And the components would now be imported as follows: |
83 | 83 | <script type="module" src="https://cdn.jsdelivr.net/npm/@playcanvas/web-components@0.1.10/dist/pwc.mjs"></script> |
84 | 84 | ``` |
85 | 85 |
|
86 | | -## Tag Reference 📖 |
87 | | - |
88 | | -Table of contents: |
89 | | - |
90 | | -- [pc-app](#pc-app) |
91 | | -- [pc-asset](#pc-asset) |
92 | | -- [pc-camera](#pc-camera) |
93 | | -- [pc-collision](#pc-collision) |
94 | | -- [pc-element](#pc-element) |
95 | | -- [pc-entity](#pc-entity) |
96 | | -- [pc-light](#pc-light) |
97 | | -- [pc-listener](#pc-listener) |
98 | | -- [pc-module](#pc-module) |
99 | | -- [pc-render](#pc-render) |
100 | | -- [pc-rigidbody](#pc-rigidbody) |
101 | | -- [pc-scene](#pc-scene) |
102 | | -- [pc-script](#pc-script) |
103 | | -- [pc-scripts](#pc-scripts) |
104 | | -- [pc-sky](#pc-sky) |
105 | | -- [pc-screen](#pc-screen) |
106 | | -- [pc-sound](#pc-sound) |
107 | | -- [pc-sounds](#pc-sounds) |
108 | | -- [pc-splat](#pc-splat) |
109 | | - |
110 | | -### pc-app |
111 | | - |
112 | | -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. |
113 | | - |
114 | | -| Attribute | Description | |
115 | | -| --- | --- | |
116 | | -| `alpha` | Boolean attribute. Determines whether the application allocates an alpha channel in the frame buffer. Defaults to `true`. | |
117 | | -| `antialias` | Boolean attribute. Determines whether the application uses anti-aliasing. Defaults to `true`. | |
118 | | -| `depth` | Boolean attribute. Determines whether the application allocates a depth buffer. Defaults to `true`. | |
119 | | -| `high-resolution` | Boolean attribute. Determines whether the application renders using physical resolution or CSS resolution. Defaults to `true`. | |
120 | | -| `stencil` | Boolean attribute. Determines whether the application allocates a stencil buffer. Defaults to `true`. | |
121 | | - |
122 | | -### pc-asset |
123 | | - |
124 | | -The `pc-asset` tag is used to define an asset. It must be a direct child of `pc-app`. |
125 | | - |
126 | | -| Attribute | Description | |
127 | | -| --- | --- | |
128 | | -| `id` | The ID of the asset. This is used to reference the asset in scripts. | |
129 | | -| `src` | The path to the asset. | |
130 | | -| `preload` | Valueless attribute. If present, the asset is loaded immediately. | |
131 | | -| `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`. | |
132 | | - |
133 | | -### pc-camera |
134 | | - |
135 | | -The `pc-camera` tag is used to define a camera component. It must be a direct child of an `pc-entity`. |
136 | | - |
137 | | -| Attribute | Description | |
138 | | -| --- | --- | |
139 | | -| `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. | |
140 | | -| `clear-color-buffer` | Boolean attribute. Controls whether the camera clears the color buffer. If unspecified, the color buffer is cleared. | |
141 | | -| `clear-depth-buffer` | Boolean attribute. Controls whether the camera clears the depth buffer. If unspecified, the depth buffer is cleared. | |
142 | | -| `clear-stencil-buffer` | Boolean attribute. Controls whether the camera clears the stencil buffer. If unspecified, the stencil buffer is cleared. | |
143 | | -| `cull-faces` | Boolean attribute. Controls whether the camera culls faces. If unspecified, faces are culled. | |
144 | | -| `far-clip` | The far clipping plane of the camera. If unspecified, `1000` is used. | |
145 | | -| `flip-faces` | Boolean attribute. Controls whether the camera flips faces. If unspecified, faces are not flipped. | |
146 | | -| `fov` | The field of view of the camera. If unspecified, `45` is used. | |
147 | | -| `frustum-culling` | Boolean attribute. Controls whether the camera uses frustum culling. If unspecified, frustum culling is used. | |
148 | | -| `horizontal-fov` | Valueless attribute. If present, the camera uses a horizontal field of view. If unspecified, the camera uses a vertical field of view. | |
149 | | -| `near-clip` | The near clipping plane of the camera. If unspecified, `0.1` is used. | |
150 | | -| `orthographic` | Valueless attribute. If present, the camera uses an orthographic projection. If unspecified, the camera uses a perspective projection. | |
151 | | -| `ortho-height` | The height of the orthographic projection. If unspecified, `10` is used. | |
152 | | -| `priority` | The priority of the camera. If unspecified, `0` is used. | |
153 | | -| `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. | |
154 | | -| `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. | |
155 | | - |
156 | | -### pc-collision |
157 | | - |
158 | | -The `pc-collision` tag is used to define a collision component. It must be a direct child of a `pc-entity`. |
159 | | - |
160 | | -| Attribute | Description | |
161 | | -| --- | --- | |
162 | | -| `axis` | The axis of the collision component. If not specified, `1` is used (Y-axis). | |
163 | | -| `convex-hull` | Valueless attribute. If present, the collision component uses a convex hull. | |
164 | | -| `enabled` | Enabled state of the collision component. If not specified, `true` is used. | |
165 | | -| `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. | |
166 | | -| `height` | The height of the collision component. If not specified, `2` is used. | |
167 | | -| `radius` | The radius of the collision component. If not specified, `0.5` is used. | |
168 | | -| `type` | The type of collision component. Can be `box`, `capsule`, `cone`, `cylinder` or `sphere`. | |
169 | | - |
170 | | -### pc-element |
171 | | - |
172 | | -The `pc-element` tag is used to define an element component. It must be a direct child of a `pc-entity`. |
173 | | - |
174 | | -| Attribute | Description | |
175 | | -| --- | --- | |
176 | | -| `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. | |
177 | | -| `asset` | A string that should match the `id` of a `pc-asset` tag that has a type of `font`. | |
178 | | -| `auto-width` | Valueless attribute. If present, the element component automatically adjusts its width. | |
179 | | -| `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. | |
180 | | -| `font-size` | The font size of the element component. If not specified, `16` is used. | |
181 | | -| `line-height` | The line height of the element component. If not specified, `1.2` is used. | |
182 | | -| `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. | |
183 | | -| `text` | The text of the element component. | |
184 | | -| `type` | The type of element component. Can be `group`, `image` or `text`. If not specified, `group` is used. | |
185 | | -| `width` | The width of the element component. If not specified, `0` is used. | |
186 | | -| `wrap-lines` | Valueless attribute. If present, the element component wraps lines. | |
187 | | - |
188 | | -### pc-entity |
189 | | - |
190 | | -The `pc-entity` tag is used to define an entity. It must be a direct child of `pc-scene` or another `pc-entity`. |
191 | | - |
192 | | -| Attribute | Description | |
193 | | -| --- | --- | |
194 | | -| `enabled` | Enabled state of the entity. If not specified, `true` is used. | |
195 | | -| `name` | The name of the entity. | |
196 | | -| `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. | |
197 | | -| `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. | |
198 | | -| `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. | |
199 | | -| `tags` | A space-separated list of tags for the entity. | |
200 | | - |
201 | | -### pc-light |
202 | | - |
203 | | -The `pc-light` tag is used to define a light component. It must be a direct child of a `pc-entity`. |
204 | | - |
205 | | -| Attribute | Description | |
206 | | -| --- | --- | |
207 | | -| `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. | |
208 | | -| `cast-shadows` | Valueless attribute. If present, the light casts shadows. | |
209 | | -| `inner-cone-angle` | The angle of the light's inner cone. If not specified, `40` is used. | |
210 | | -| `intensity` | The intensity of the light. If not specified, `1` is used. | |
211 | | -| `normal-offset-bias` | The bias of the light's normal offset. If not specified, `0.05` is used. | |
212 | | -| `outer-cone-angle` | The angle of the light's outer cone. If not specified, `45` is used. | |
213 | | -| `range` | The range of the light. If not specified, `10` is used. | |
214 | | -| `shadow-bias` | The bias of the light's shadows. If not specified, `0.2` is used. | |
215 | | -| `shadow-distance` | The distance at which the light's shadows are no longer rendered. If not specified, `16` is used. | |
216 | | -| `type` | The type of light. Can be `directional`, `point` or `omni`. | |
217 | | - |
218 | | -### pc-listener |
219 | | - |
220 | | -The `pc-listener` tag is used to define a listener component. It must be a direct child of a `pc-entity`. It has no attributes. |
221 | | - |
222 | | -### pc-module |
223 | | - |
224 | | -The `pc-module` tag is used to define a WASM module. It must be a direct child of `pc-app`. |
225 | | - |
226 | | -| Attribute | Description | |
227 | | -| --- | --- | |
228 | | -| `name` | The name of the module. This is used to reference the module in scripts. | |
229 | | -| `glue` | The path to the glue code for the module. | |
230 | | -| `wasm` | The path to the WASM file for the module. | |
231 | | -| `fallback` | The path to the fallback (asm.js) code for the module. | |
232 | | - |
233 | | -### pc-render |
234 | | - |
235 | | -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`. |
236 | | - |
237 | | -| Attribute | Description | |
238 | | -| --- | --- | |
239 | | -| `type` | The type of render component. Can be `box`, `capsule`, `cone`, `cylinder`, `plane` or `sphere`. | |
240 | | -| `cast-shadows` | Valueless attribute. If present, the render component casts shadows. | |
241 | | -| `receive-shadows` | Valueless attribute. If present, the render component receives shadows. | |
242 | | - |
243 | | -### pc-rigidbody |
244 | | - |
245 | | -The `pc-rigidbody` tag is used to define a rigidbody component. It must be a direct child of a `pc-entity`. |
246 | | - |
247 | | -| Attribute | Description | |
248 | | -| --- | --- | |
249 | | -| `angular-damping` | The angular damping of the rigidbody. If not specified, `0` is used. | |
250 | | -| `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. | |
251 | | -| `friction` | The friction of the rigidbody. If not specified, `0.5` is used. | |
252 | | -| `linear-damping` | The linear damping of the rigidbody. If not specified, `0` is used. | |
253 | | -| `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. | |
254 | | -| `mass` | The mass of the rigidbody. If not specified, `1` is used. | |
255 | | -| `restitution` | The restitution of the rigidbody. If not specified, `0` is used. | |
256 | | -| `rolling-friction` | The rolling friction of the rigidbody. If not specified, `0` is used. | |
257 | | -| `type` | The type of rigidbody component. Can be `static`, `kinematic` or `dynamic`. | |
258 | | - |
259 | | -### pc-scene |
260 | | - |
261 | | -The `pc-scene` tag is used to define the scene. It must be a direct child of `pc-app`. |
262 | | - |
263 | | -| Attribute | Description | |
264 | | -| --- | --- | |
265 | | -| `fog` | The type of fog to use. Can be `linear`, `exp`, or `exp2`. | |
266 | | -| `fog-color` | The color of the fog. Can be a CSS color string or a hex color code. | |
267 | | -| `fog-start` | The start distance of the fog. | |
268 | | -| `fog-end` | The end distance of the fog. | |
269 | | -| `fog-density` | The density of the fog. | |
270 | | - |
271 | | -### pc-screen |
272 | | - |
273 | | -The `pc-screen` tag is used to define a screen component. It must be a direct child of a `pc-entity`. |
274 | | - |
275 | | -| Attribute | Description | |
276 | | -| --- | --- | |
277 | | -| `blend` | Valueless attribute. If present, the screen component blends. | |
278 | | -| `priority` | The priority of the screen component. Must be an integer between `0` and `255`. If not specified, `0` is used. | |
279 | | -| `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. | |
280 | | -| `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. | |
281 | | -| `scale-blend` | The scale blend of the screen component. Must be a number between `0` and `1`. If not specified, `0.5` is used. | |
282 | | -| `screen-space` | Valueless attribute. If present, the screen component is in screen space. | |
283 | | - |
284 | | - |
285 | | -### pc-script |
286 | | - |
287 | | -The `pc-script` tag is used to define a script. It must be a direct child of a `pc-scripts` component. |
288 | | - |
289 | | -| Attribute | Description | |
290 | | -| --- | --- | |
291 | | -| `attributes` | A JSON string of attributes for the script. | |
292 | | -| `enabled` | Enabled state of the script. If not specified, `true` is used. | |
293 | | -| `name` | The name of the script. | |
294 | | - |
295 | | -### pc-scripts |
296 | | - |
297 | | -The `pc-scripts` tag is used to define a scripts component. It must be a direct child of a `pc-entity`. |
298 | | - |
299 | | -| Attribute | Description | |
300 | | -| --- | --- | |
301 | | -| `enabled` | Enabled state of the scripts component. If not specified, `true` is used. | |
302 | | - |
303 | | -### pc-sky |
304 | | - |
305 | | -The `pc-sky` tag is used to define a sky component. It must be a direct child of a `pc-scene`. |
306 | | - |
307 | | -| Attribute | Description | |
308 | | -| --- | --- | |
309 | | -| `asset` | A string that should match the `id` of a `pc-asset` tag that has a type of `texture`. | |
310 | | -| `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. | |
311 | | -| `intensity` | The intensity of the sky. If not specified, `1` is used. | |
312 | | -| `level` | The mipmap level used to render the sky. If not specified, `0` is used (base mip level). | |
313 | | -| `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. | |
314 | | -| `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. | |
315 | | -| `type` | The type of sky component. Can be `box`, `dome`, `infinite` or `none`. | |
316 | | - |
317 | | -### pc-sound |
318 | | - |
319 | | -The `pc-sound` tag is used to define a sound. It must be a direct child of a `pc-sounds`. |
320 | | - |
321 | | -| Attribute | Description | |
322 | | -| --- | --- | |
323 | | -| `asset` | A string that should match the `id` of a `pc-asset` tag that has a type of `audio`. | |
324 | | -| `auto-play` | Valueless attribute. If present, the sound slot plays automatically. | |
325 | | -| `duration` | The duration of the sound slot. | |
326 | | -| `loop` | Valueless attribute. If present, the sound slot loops. | |
327 | | -| `name` | The name of the sound slot. | |
328 | | -| `overlap` | Valueless attribute. If present, the sound slot overlaps. | |
329 | | -| `pitch` | The pitch of the sound slot. If not specified, `1` is used. | |
330 | | -| `start-time` | The start time of the sound slot. If not specified, `0` is used. | |
331 | | -| `volume` | The volume of the sound slot. If not specified, `1` is used. | |
332 | | - |
333 | | -### pc-sounds |
334 | | - |
335 | | -The `pc-sounds` tag is used to define a sound component. It must be a direct child of a `pc-entity`. |
336 | | - |
337 | | -| Attribute | Description | |
338 | | -| --- | --- | |
339 | | -| `distance-model` | The distance model of the sound. Can be `exponential`, `inverse` or `linear`. If not specified, `linear` is used. | |
340 | | -| `pitch` | The pitch of the sound. If not specified, `1` is used. | |
341 | | -| `max-distance` | The maximum distance from the listener at which audio falloff stops. If not specified, `10000` is used. | |
342 | | -| `positional` | Valueless attribute. If present, the sound is positional. | |
343 | | -| `ref-distance` | The distance from the listener at which the volume will be at full volume. If not specified, `1` is used. | |
344 | | -| `roll-off-factor` | The factor used in the falloff equation. If not specified, `1` is used. | |
345 | | -| `volume` | The volume of the sound. If not specified, `1` is used. | |
346 | | - |
347 | | -### pc-splat |
348 | | - |
349 | | -The `pc-splat` tag is used to define a splat component. It must be a direct child of a `pc-entity`. |
350 | | - |
351 | | -| Attribute | Description | |
352 | | -| --- | --- | |
353 | | -| `asset` | A string that should match the `id` of a `pc-asset` tag that has a type of `gsplat`. | |
354 | | -| `enabled` | Enabled state of the splat component. If not specified, `true` is used. | |
0 commit comments