MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
Loading...
Searching...
No Matches
mln_animation_options Struct Reference

#include <map.h>

Data Fields

double duration_ms
 
double velocity
 
double min_zoom
 
uint64_t transition_id
 

Detailed Description

Optional animation controls for camera transitions.

Field Documentation

◆ duration_ms

double mln_animation_options::duration_ms

Duration in milliseconds. Must be finite and non-negative. Values that would overflow MapLibre Native's internal duration are invalid.

When this field is omitted, ease, pan, zoom, rotate, and pitch transitions default to zero and apply instantly, while mln_map_fly_to() derives a duration from velocity instead.

◆ min_zoom

double mln_animation_options::min_zoom

Peak zoom for flyTo transitions.

◆ transition_id

uint64_t mln_animation_options::transition_id

Caller-chosen identity for the transition this options struct starts.

When MLN_ANIMATION_OPTION_TRANSITION_ID is set, the transition emits one MLN_RUNTIME_EVENT_MAP_CAMERA_TRANSITION_FINISHED event carrying this value in its mln_runtime_event_camera_transition_finished payload. The C API passes the value through without interpreting it, so callers pick their own scheme, such as a monotonically increasing counter.

Each command emits that event once all its properties have completed or been superseded. Replacing one property leaves the command active while another property continues. Cancelling all transitions also ends every active command. A zero-duration ease emits its event during the call. A command this API rejects – one carrying a non-finite enabled camera field, for example – starts no transition and emits no such event. The event carries no completion reason, so a host that needs to tell completion from cancellation compares the resulting camera against the requested one, or tracks which commands own the requested properties.

The event is queued on the runtime that owns the map and is drained by mln_runtime_drain_events(). It is queued immediately before that command's MLN_RUNTIME_EVENT_MAP_CAMERA_DID_CHANGE event. Other commands can still be animating when these events arrive. A map reports the terminal outcome only while its event mask selects MLN_RUNTIME_EVENT_MAP_CAMERA_TRANSITION_FINISHED.

When this field is omitted, the transition emits no such event.

◆ velocity

double mln_animation_options::velocity

Average flyTo velocity in screenfuls per second. Must be positive. Defaults to 1.2 when omitted. Applies to mln_map_fly_to().


The documentation for this struct was generated from the following file: