You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Applies an effect to the player. If the player already has an effect, it is replaced. If this function is called with `null` it removes any active effect.
50
+
51
+
All options are optional.
52
+
53
+
**anchor**: an [Anchor](/docs/ref/Anchor.md) to attach the player to
54
+
55
+
**emote**: a url to an emote to play while this effect is active
56
+
57
+
**snare**: a multiplier from 0 to 1 that reduces movement speed, where zero means no snaring and one means entirely snared. when snared, players can still turn and attempt to move.
58
+
59
+
**freeze**: when true, the player is frozen in place and all movement keys are ignored.
60
+
61
+
**turn**: when true, the player will continually face the direction the camera is looking in.
62
+
63
+
**duration**: how long this effect should last in seconds.
64
+
65
+
**cancellable**: whether any movement keys will cancel the effect. if enabled, freeze is ignored.
66
+
67
+
**onEnd**: a function that should be called either at the end of the `duration` or when the player moves if `cancellable`.
Whether this UI should be rendered in `world` space or `screen` space.
15
+
When `world`, a plane geometry is physically placed in the world.
16
+
When `screen`, the canvas is drawn directly on the screen.
17
+
Defaults to `world`.
18
+
19
+
NOTE: when using `screen`, the `.position` value now represents a ratio from 0 to 1 on each axis. For example `position.x = 1` is the far right of the screen and `position.x = 0` is the far left. Use this in combination with the `pivot` and `offset` values.
20
+
21
+
```jsx
22
+
/**
23
+
* Example:
24
+
* The following screen-space UI is rendered in the top left of the
25
+
* screen, 20px away from both edges.
26
+
*/
27
+
constui=app.create('ui', {
28
+
space:'screen',
29
+
pivot:'top-right',
30
+
position: [1, 0, 0] // far right
31
+
offset: [-20, 20, 0] // 20px left, 20px down
32
+
})
33
+
```
34
+
12
35
### `.width`: Number
13
36
14
37
The width of the UI canvas in pixels. Defaults to `100`.
@@ -42,6 +65,16 @@ Determines where the "center" of the UI is.
The offset in pixels applied after the `position` value.
72
+
73
+
### `.pointerEvents`: Boolean
74
+
75
+
Whether the UI should receive or ignore pointer events. Defaults to `true`.
76
+
If you are building informational screen-space UI that does not need to respond to pointer events, this should be set to `false` for an improved user experience.
0 commit comments