Dust
Swarm behavior studies with RxJs
The ultimate goal is to simulate particles that move in swarms and calculate their
position independently, similar to flocks of birds.
They should take into account disturbances, walls, individual initiative, and landing areas.
Animation 1
Goal: Animate several seahorses over an interval.
Key points:
- range() used to create N divs
- interval() used to create FPS
Animation 2
Goal: Scare a seahorse with a click. Move her to a safe distance away.
Key points:
- last() used with takeWhile() to only update state store at end
- scan() re-emits on each emission. reduce() only emits after last emission (take()).
- CustomEvent can bridge streams
- State store passed between streams
- Random movement vector, collision detection