A creature rigged and animated by hand, arriving as a single .glb with eleven bones and four movements in it. Three of them go round for ever. The fourth does not, and that is what this example is about. Click the game, then press 1, 2 or 3 to change gait, space to drop it.
A looping movement never needs to report anything: it is always in the middle of itself. A movement that finishes does. Its clip says it once, in clips: Death: { loop: false, next: 'Idle' } runs to its end, stops there and is followed by Idle, and onEnd is told once when it arrives: a hit, a death, a door opening. The file has nowhere to say any of it, so it is said here.
The end is not the only moment worth knowing about. A clip's events mark instants inside a movement and onEvent is told as the movement passes them: here, the two instants in each gait where a foot meets the ground. A mark is passed once per lap whatever the frame rate, so a frame long enough to step clean over one still counts it.