Constructor
new Trail3D(pos3Dopt, lifeTimeopt, widthopt, tileInfoopt, coloropt, colorEndopt, additiveopt)
Create a trail
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
pos3D | Vector3 | <optional> | ||
lifeTime | number | <optional> | 1 | Seconds the ribbon takes to thin and fade from head to tail, Infinity keeps every sample at full width and never drops one, so it grows as long as the object moves |
width | number | <optional> | 0.2 | Width at the head, it thins to nothing at the tail |
tileInfo | TileInfo | | <optional> | Tile or whole texture stretched along the trail, undefined is untextured | |
color | Color | <optional> | Color at the head | |
colorEnd | Color | <optional> | Color at the tail | |
additive | boolean | <optional> | false | Additive blending |
const trail = new Trail3D(vec3(), 1, .3, undefined, hsl(.08, 1, .5), hsl(0, 1, .5, 0), true);
ball.addChild(trail); // follows the ballExtends
- EngineObject3D
Members
colorEnd
Properties| Type | Description |
|---|---|
| Color | Color at the tail |
lifeTime
Properties| Type | Description |
|---|---|
| number | Seconds the ribbon takes to thin and fade from head to tail, Infinity never drops a sample |
samples :Array.<{pos: Vector3, side: (Vector3|undefined), time: number}>
- Array.<{pos: Vector3, side: (Vector3|undefined), time: number}>
| Type | Description |
|---|---|
| Array.<{pos: Vector3, side: (Vector3|undefined), time: number}> | Recorded samples, oldest first |
side :Vector3|undefined
- Vector3 |
undefined
| Type | Description |
|---|---|
| Vector3 | | Direction across the ribbon, recorded with each sample, undefined faces the camera |
width
Properties| Type | Description |
|---|---|
| number | Width at the head |
Methods
clear()
Forget the trail so far, for when the object teleports
destroy(immediateopt)
Stop recording, and go away once the ribbon has faded
| Name | Type | Attributes | Description |
|---|---|---|---|
immediate | boolean | <optional> |
render3D() → {void}
Draw the ribbon
- Type:
- void
update()
Record the position when it moved and drop old samples, called automatically each frame