Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielitoCode/Spatial/llms.txt
Use this file to discover all available pages before exploring further.
MotionSpec controls how CameraState.animateTo() computes animation duration and easing. Spatial uses an adaptive planner by default — MotionSpec.Adaptive — that derives how long an animation should take from the angular distance (yaw and pitch delta) and the relative zoom distance to travel, so short moves feel snappy and long arcs feel cinematic without you hand-tuning durations.
MotionSpec Variants
MotionSpec.Adaptive (default)
The adaptive planner calculates duration from the distance the camera has to travel, then clamps the result to a comfortable range.
| Property | Value |
|---|---|
| Default angular velocity | 180 °/sec |
| Default zoom velocity | 1.75 per second |
| Minimum duration | 120 ms |
| Maximum duration | 1 200 ms |
| Easing | MotionEasing.SmoothStep |
MotionSpec.Adaptive (or omit the motion parameter entirely) for most animateTo calls:
MotionSpec.Instant
Duration is 0 ms — the camera teleports to the target position with no intermediate frames. Use this for programmatic resets or state restoration where an animated transition would be confusing:
MotionSpec.custom
Factory function for tuned profiles when neither Adaptive nor Instant is quite right:
MotionSpec.Adaptive, so you only need to override what you want to change.
| Parameter | Type | Default | Description |
|---|---|---|---|
minDurationMillis | Long | 120 | Floor for adaptive duration in milliseconds. |
maxDurationMillis | Long | 1200 | Ceiling for adaptive duration in milliseconds. |
targetAngularVelocityDegreesPerSecond | Float | 180f | Ideal orbit speed; drives adaptive duration calculation. |
targetZoomVelocityPerSecond | Float | 1.75f | Ideal zoom speed; drives adaptive duration calculation. |
easing | MotionEasing | SmoothStep | Interpolation curve applied to the animation fraction. |
Using MotionSpec with animateTo
Explicit Duration Override
animateTo also accepts an optional durationMillis parameter that bypasses the adaptive planner entirely and forces an exact animation length:
durationMillis takes precedence over the profile’s adaptive calculation when both are provided.
Easing
MotionEasing is a single-function interface that maps a linear progress fraction [0, 1] to a visual progress fraction:
MotionEasing.SmoothStep (default)
Applies smooth acceleration at the start and deceleration at the end using the cubic smoothstep formula t² × (3 − 2t). This is the default for MotionSpec.Adaptive and MotionSpec.custom.
MotionEasing.Linear
Constant velocity — progress is applied directly with no acceleration or deceleration. Used internally by MotionSpec.Instant.
Adaptive Duration Algorithm
The adaptive planner inresolveCameraMotionPlan computes duration in three steps:
Compute zoom distance
Zoom distance uses a logarithmic (relative) measure so that zooming from 1× to 2× feels the same as zooming from 2× to 4×:
Related
- Camera — full reference for
CameraStateandanimateTo - API — MotionSpec — complete API reference for
MotionSpecandMotionEasing