What it does
The pack registers twelve presets with trails-3d, the shader-drawn ribbon renderer.
game.trails.preset(name, { follow }) starts one: it records the path, draws a continuous ribbon behind the object, sheds sparks along the way
and ends by itself once the target is gone and its tail has run out.
The idea is that one ribbon, with its dials set differently, makes very different looks. flame and neon are the
same ribbon with fibre and erosion at opposite ends: flame shreds into wisps, neon is a hard flat-topped band.
lightwall stands the clean look up off the path as a wall; plasma and sparkler lean on crackle, so glints crawl
inside the ribbon; smokewake and shadow are not additive, because smoke and darkness hide light. A trail can also
be fed by hand with point() each step, the tip of a sword as it swings, and jump() moves the head for a teleport
without a streak across the world.
Features
- Fire and energy —
flame, a burning wake shedding rising embers, andplasma, electric blue with sparks spitting off it. - Clean light —
neon, a hard blue band for a racer, andlightwall, a wall of light standing on the path, the light-cycle trail. - Ice and space —
frost, an icy band breaking into shards, andcomet, a white-hot head with a long dusty tail. - Celebration —
rainbow, the spectrum head to tail, andsparkler, a white-gold streak spraying golden sparks. - Dark trails —
smokewake, a grey wake for a damaged engine, andshadow, a violet-black wisp for a wraith. - Weapons and hazards —
slash, a pale arc gone in about a fifth of a second, andtoxic, a green wake that drips.
Good for
- Spellcasting — fireballs, ice bolts, plasma bolts and curses with a trail behind them.
- Melee games — a slash ribbon on every sword swing or claw swipe.
- Racing and arena games — neon behind racers and hover bikes, light-cycle walls behind bikes.
- Space and flight — comets, meteors, firework rockets and a smoke wake behind a crashing plane.
Make it yours
preset(name, overrides) takes any trail spec key, so a game re-skins or re-sizes a preset without copying it: a red
light cycle is lightwall with new colors, a thinner frost for a small ice dart is frost with a smaller width
and a shorter life. An offset puts the trail at an exhaust point rather than the object's centre. For a look of
your own, copy a definition and register it with registerTrail3d from trails-3d.
A quick look
A comet tail on an orb, a red light cycle and a sword slash fed by hand:
game.trails.preset('comet', { follow: orb });
game.trails.preset('lightwall', { follow: bike, colors: ['#ffc0b0', '#ff4020', '#a01000', '#300400'] });
const swing = game.trails.preset('slash');
game.step('blade', () => swing.point(tip.x, tip.y, tip.z));
swing.stop();
Works with
trails-3dandparticle-textures— required: the ribbon renderer and the frame its sparks draw with.post-bloom— makes the additive trails glow.particles-3d— a trail of separate particles rather than a ribbon, such as dust behind a runner.particles-2d— the 2D counterpart, with an emitter that emits per distance travelled.
Good to know
- The trails are tuned for objects moving a few world units a second: a much faster one wants a smaller
spacing, a much slower one a shorterlife. - One ribbon per trail, with no branches or forks; a lightning tree is
vfx3d-lightning's job. smokewakeandshadowdraw dark over anything, so against a black skyshadowreads only by its violet head.lightwallignores the camera by design, so from directly overhead it is a line; headless, nothing draws.






