Table of Contents

Class MomentumDecay

Namespace
Maplibre.NativeFfi
Assembly
Maplibre.NativeFfi.dll

How one part of a gesture's momentum slows from its release speed.

public sealed record MomentumDecay : IEquatable<MomentumDecay>
Inheritance
MomentumDecay
Implements
Inherited Members

Remarks

Speeds and distances are in the part's unit: logical pixels for pan, zoom levels for zoom, and degrees for bearing and pitch. A setting whose bit isn't set takes the part's default, which GestureMomentum lists. min_speed is finite and not negative, and every other number is finite and positive. A friction decay can serve every release, as a preset that matches a platform's scrolling. An eased glide takes its direction from the part's velocity, and its distance and duration from the caller's plan.

See mln_momentum_decay in the C API reference.

Properties

Distance

Required for MomentumDecayModel.Ease.

public double? Distance { get; init; }

Property Value

double?

DurationMs

Required for MomentumDecayModel.Ease.

public double? DurationMs { get; init; }

Property Value

double?

Easing

For MomentumDecayModel.Ease, the share of distance covered over the share of duration_ms. Its control points are between 0 and 1, so the glide never passes its distance. Defaults to (0, 0, 0.25, 1), the curve that camera animations ease along by default. Android's scroll fling follows (0.175, 0.5, 0.35, 1).

public UnitBezier? Easing { get; init; }

Property Value

UnitBezier?

HalfLifeMs

For MomentumDecayModel.Friction, how long the speed takes to halve.

public double? HalfLifeMs { get; init; }

Property Value

double?

MaxDistance

The farthest the part moves. A friction release that would move farther starts slower, so it ends sooner, and a planned glide moves at most this far over its duration.

public double? MaxDistance { get; init; }

Property Value

double?

MaxSpeed

For MomentumDecayModel.Friction, a faster release counts as this.

public double? MaxSpeed { get; init; }

Property Value

double?

MinSpeed

A slower release starts no momentum.

public double? MinSpeed { get; init; }

Property Value

double?

Model

public MomentumDecayModel? Model { get; init; }

Property Value

MomentumDecayModel?

StopSpeed

For MomentumDecayModel.Friction, the speed at which it ends.

public double? StopSpeed { get; init; }

Property Value

double?