Sun Arc
A time-of-day picker drawn as the sun's real path over a city: sunrise, solar noon and sunset come from a solar-position model for a latitude, longitude and day, and the sky, the light on the water and the lit windows follow the sun's altitude. With a `photo` of the place, its own sky is replaced by the one for the chosen time, the sun stands at its true azimuth and altitude through the photo's lens, and the foreground is relit. UI SDK's slider in minutes since local midnight, with setTime, sunrise, sunset and solarNoon for agents, and calibrate for a photo.
Example
- 6:20 AM
- 10°
Read on this device, never uploaded. Cebu City skyline by DisRaptor18, CC0, Wikimedia Commons.
Installation
lucide-reactUsage
Reach for it where the time of day matters for the light, like scheduling a shoot, a walk or a delivery window: the sun's path is the real one for the place and day. For a plain time, use the TimeInput from DateTimePicker.
API reference
SunArc
| Prop | Type | Default |
|---|---|---|
labelrequiredThe accessible name of the picker as a whole. | string | – |
latituderequiredDegrees north of the equator, −90 to 90. | number | – |
longituderequiredDegrees east of Greenwich, −180 to 180. | number | – |
dateThe day whose sun it shows; today by default. | Date | – |
timeZoneThe IANA time zone the minutes are counted in, like `"Europe/Madrid"`; the runtime's own by default. | string | – |
valueMinutes since local midnight, 0 to 1439. Pass it to control the picker. | number | – |
defaultValueSolar noon, rounded to the step, by default. | number | – |
onValueChangeRuns on every step of a drag or a key, with UI SDK's slider details (`reason`, `source`, `cancel()`). | (minutes: number, details: SliderValueChangeDetails) => void | – |
onValueCommitRuns once a drag or a key press that changed the value ends, for saving. | (minutes: number) => void | – |
stepMinutes per arrow key; 5 by default. Page Up and Page Down move an hour. | number | 5 |
localeThe locale times and degrees are written in; the page's `lang`, or the runtime's default without one. | string | – |
disabled | boolean | false |
nameSubmits the minutes under this name in a form. | string | – |
labels | Partial<SunArcLabels> | – |
classNameClasses for the root; a function gets the picker's state. | string | ((state: SunArcState) => string | undefined) | – |
onPaintCalled with each sky paint's duration in ms, for measuring. | (milliseconds: number) => void | – |
photoA photo of the place to draw the sky into instead of the drawn city: its own sky is replaced by the one for the chosen time, the sun stands at its true azimuth and altitude through the photo's lens, and the foreground is relit. | SunArcPhoto | – |
onPhotoChangeRuns with the photo and its resolved view each time it is calibrated, for the app to keep; nothing is stored here. | (photo: SunArcPhoto & SunArcPhotoView) => void | – |
SunArcPhotoLayers
| Prop | Type | Default |
|---|---|---|
srcrequired | string | – |
skyrequired | SkyPhotoState | undefined | – |
pathrequired | { day: string; night: string } | – |
SunArcCalibration
| Prop | Type | Default |
|---|---|---|
viewrequired | SunArcPhotoView | – |
markingrequired | boolean | – |
disabledrequired | boolean | – |
labelsrequired | SunArcPhotoLabels | – |
onViewrequired | (change: Partial<SunArcPhotoView>) => void | – |
onMarkingrequired | (marking: boolean) => void | – |
formatrequired | (value: number) => string | – |
SunArcPhotoUpload
| Prop | Type | Default |
|---|---|---|
labelrequiredThe button's text, and its accessible name. | string | – |
onPhotorequiredRuns with the photo, read locally as an object URL, and its GPS position when the EXIF has one. | (photo: SunArcPhoto, place: SunArcPhotoPlace | undefined) => void | – |
disabled | boolean | false |
Other exports
sunArcLabelsminutesOfsunArcdomeLocatordomeScalehorizonAtsceneAtskylinestarssunPathtimeToXcalendarInminutesPerDayskyAtsolarDaysunAltitudesunPositionuseSunArcScenesunArcPhotoLabelsnearestMinutesphotoLocatorphotoPathphotoPathSamplescaptureOfuseSunArcPhotouseObjectUrlOwneruseSkyPhototype SunArcLabelstype SunArcPropstype SunArcStatetype SunArcCalibratetype SunArcOptionstype SunArcSlidertype SunArcLocatetype SunArcOuttype SunArcSpottype SunArcVarstype Skytype SolarDaytype SolarPlacetype SunArcPhototype SunArcPhotoLabelstype SunArcPhotoPlacetype SunArcPhotoUploadPropstype SunArcPhotoViewtype PhotoPathSampletype SkyPhotoFeaturestype SkyPhotoStateAccessibility
- The arc is a slider in minutes: arrows step by the step (5 minutes), Page Up and Page Down an hour, Home and End the ends of the day, and it reads as the time in the page's locale.
- On touch only the sun and the ground strip take a drag, so the page still scrolls over the sky. The sun keeps a 44px hit area.
- Under reduced motion the sun jumps to a preset instead of gliding.
- The stage is a sky in every theme, so the focus ring on it is white; the readout and buttons follow the theme.
- With a photo, the photo is decoration; the time is in the slider. Calibrate's Heading, Field of view and Horizon are named sliders, and Mark the sun a toggle; dragging the sun follows its arc across the photo.
- A sun out of the photo's view waits at the edge it left by with an arrow, and below the horizon on the horizon, so the slider's thumb never leaves the stage.
Agent actions
Agents find it by its label and call setTime (minutes or "HH:MM"), sunrise, sunset or solarNoon; sunrise and sunset fail the step with why in a polar day or night. With a photo, calibrate(heading, fov?, horizon?) points the view; without one it fails with why.
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.