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 |
- Source
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 |
- Source
lifeTime
Properties| Type | Description |
|---|---|
| number | Seconds the ribbon takes to thin and fade from head to tail, Infinity never drops a sample |
- Source
samples :Array.<Object>
- Array.<Object>
| Type | Description |
|---|---|
| Array.<Object> | Recorded samples, oldest first |
- Source
side :Vector3|undefined
- Vector3 |
undefined
| Type | Description |
|---|---|
| Vector3 | | Direction across the ribbon, recorded with each sample, undefined faces the camera |
- Source
width
Properties| Type | Description |
|---|---|
| number | Width at the head |
- Source
Methods
clear()
Forget the trail so far, for when the object teleports
- Source
destroy(immediateopt)
Stop recording, and go away once the ribbon has faded
| Name | Type | Attributes | Description |
|---|---|---|---|
immediate | boolean | <optional> |
- Source
render3D()
Draw the ribbon
- Source
update()
Record the position when it moved and drop old samples, called automatically each frame
- Source