This interactive railroad simulation demonstrates Catmull-Rom splines (converted to cubic Bézier curves) to define a closed track.
- Drag the black control points on the canvas to reshape the track in real time.
- Shift + Left-click anywhere on the canvas to add a new control point, and Ctrl + Left-click on an existing point to remove it.
- Use the slider to scrub the train's position along the track.
- Check go to animate the train; uncheck to pause.
- Keep the arc-length option enabled for constant speed; disable it for speed that varies with curvature.
- Toggle simple track to switch between a single-line spline and a full set of parallel rails with ties.
- Use the tension slider to adjust the curvature of the track.
- Note: Dragging points, adding points, and removing points are not mobile compatible yet and will be worked on.