← all demos · chapter 06

Fragmented trails — a comet made of pieces

The first trails demo smears the whole canvas. This one is the other family: the moving thing drops individual fragments behind it, and each fragment lives its own tiny life. Change what a fragment is — fire, star, waterdrop, sparkle — and the same trail becomes a different spell. Move your pointer over the canvas to steer the comet yourself.

Notice what stayed identical across all four styles: born at the head, drift, fade, die. Only the fragment's costume changed. This is also the whole mechanism of "cursor trail" effects — the head is simply your pointer.

Try tweaking: STYLE — all four · fragments per frame 3 → 12 (opulent) → 1 (understated) · mix two styles by calling spawn twice with different STYLE values temporarily set · fire's vy range to rand(20, 70): falling embers · the head's spring 60 / drag 7 → 200 / 4 (twitchy, loops a lot) → 60 / 16 (no overshoot at all — notice how much deader it looks).

In Godot: spawn by distance moved, one costume per fragment style — download trails_fragments.gd (keys 1–4 switch ember/star/drop/sparkle); or attach a CPUParticles2D to the moving node. In Unity: a Particle System with Rate over Distance emission — fragments appear only while moving, which feels wonderful. In Unreal: a Niagara emitter using spawn-per-unit. Chapter 06 · chapter 12 deploys this as a cursor trail.