Introduction
Kinesis.js is a TypeScript-first, framework-agnostic interpolation engine that smoothly animates real-time vehicle positions across any map — turning sparse, periodic pings into continuous 60fps motion.
The problem
Real-time fleet feeds are sparse. A backend sends each vehicle's position every one, five, or ten seconds — but a map redraws sixty times a second. Apply each update directly and every marker teleports: it sits still, then jumps to the next coordinate, then sits still again. On a dispatch screen that stays open all shift, the jitter is exhausting and makes positions hard to read.
The solution
Kinesis.js sits between your feed and your map. It keeps the last couple of points per vehicle and, on every animation frame, computes where the vehicle should be right now — interpolating along the path between two known positions. The marker glides instead of jumping.
import { Tracker } from '@kinesisjs/core';
import { OpenLayersAdapter } from '@kinesisjs/openlayers';
const tracker = new Tracker({
adapter: new OpenLayersAdapter(map),
interpolation: 'adaptive',
});
tracker.start();
ws.onmessage = (e) => tracker.ingest(JSON.parse(e.data));The 30-second mental model
Two facts explain almost everything about how the engine behaves:
- The engine only fills the gap between two known points. It interpolates; it does not predict the future. Until a second ping arrives, there is nothing to move between.
- Display stays behind real time by roughly one feed period. A small render-lag buffer (
renderLagMs, default1000) guarantees there are always two points to interpolate between, so motion is continuous rather than snapping on arrival.
Set renderLagMs ≈ feed period. A 5-second feed wants renderLagMs: 5000; a 1 Hz feed is happy with the default.
Architecture at a glance
Kinesis.js ships as small, composable packages across three layers. You depend only on what your stack needs.
| Layer | Package(s) | Responsibility |
|---|---|---|
| Core | @kinesisjs/core | Clock, interpolation, lifecycle, events, math. Zero deps. |
| Adapter | @kinesisjs/openlayers · @kinesisjs/leaflet | Create / update / remove map features; styling and trails. |
| Wrapper | @kinesisjs/angular | Reactive inputs and framework-managed teardown. |
See Architecture & concepts for the full responsibility model and data pipeline.
Versioning & migration
Kinesis.js follows semantic versioning, and the 0.1.x line has stayed backward-compatible. Notable changes:
- 0.1.0 → 0.1.1 — real-time interpolation fix: positions no longer snap on ingest; the
renderLagMsbuffer was introduced. Angular AOT build fix. - 0.1.1 → 0.1.2 — adaptive
minPeriodMsdefault lowered1000 → 500so steady 1 Hz feeds no longer sit on the zone boundary. Four new directive inputs.
None of the 0.1.x updates require code changes. Upgrade freely.
Next steps
- Quick start — install and render your first live map.
- Interpolation modes — pick the right curve for your feed.
- API reference — every option, method and event.