Reference · The Sun, Moon and planets: pure parts
rideTiltLimitsfunction
The range of the controls' tilt that does something in the horizon look: from straight down to a little above the horizon. A tilt beyond it moves nothing, so a page holds the tilt to it, and a drag back starts moving at once instead of after the
excess is dragged back. It depends on the height (the horizon is further from straight down the higher the camera is) and the zoom. The down look has no such range.
Import it
import { rideTiltLimits } from "@johnmorrisdotca/chikyu-earth/space";
Definition
function rideTiltLimits(distance: number, look: RideLook, zoom: number): { min: number; max: number; } | null
Parameters
| Name | Type | Description |
|---|---|---|
distance | number | The camera's distance from the Earth's centre, in Earth radii. |
look | RideLook | The look. |
zoom | number | The shared controls' zoom. |
Returns
{ min: number; max: number; } | null
The lowest and highest tilt, or null for the down look.
Examples
import { rideTiltLimits } from "@johnmorrisdotca/chikyu-earth/space";
const range = rideTiltLimits(1.066, "horizon", 1);
console.log(range && `${range.min.toFixed(0)} to ${range.max.toFixed(0)}`, rideTiltLimits(1.066, "down", 1));-35 to 38 nullWhat it prints (run when this page was built)