lucide library

The lucide icon pack as stroke_morph icon data.

Classes

BlockTransport
Block transport parameters, set by the global hybrid.
CubicPath
Normalized subpath: a chain of cubics packed as points [p0, c1, c2, p1, c1', c2', p2, …] → a Float64List of length 2·(3m+1), with m the number of segments. Consecutive segments share an endpoint.
IconEl
One element of Lucide-style icon data: a [tag, attrs] pair.
MorphController
Drives one morphing icon.
MorphIcon
A stroke icon that morphs into any other stroke icon.
MorphIconData
Input accepted by the core: either an IconNode or a raw d attribute.
MorphIconState
MorphLucideIcons
Every lucide icon, as a named constant.
MorphPainter
MorphPlan
NodeIcon
An icon given as Lucide-style [tag, attrs] data.
PathIcon
An icon given as a raw d attribute.
PlanItem
Sampled
Subpath sampled at N points by arc length, plus its topology.
Spring
SpringConfig
A spring configuration: stiffness and damping.
SvgDocument
An SVG document reduced to what this library needs.
SvgIcon
Loads morphable icon data from SVG documents.

Enums

SpringPreset
Spring presets (ζ = c/(2√k)) with the API's public names.

Constants

iconGrid → const double
The coordinate space every supported icon pack draws on. Foreign grids are re-gridded once with fitIcon, never at paint time.

Properties

kappa double
Control-point offset for a quarter circle: (4/3)·tan(π/8) ≈ 0.5523.
final

Functions

allocOutputs(MorphPlan plan) List<Float64List>
Preallocated output buffers for a plan (zero allocation per frame).
buildCubicPath(List<CubicPath> paths) Path
Builds the exact cubic path of a normalized icon — the at-rest shape.
buildPlan(List<Sampled> srcSubs, List<Sampled> dstSubs) MorphPlan
Builds the morph plan between two lists of sampled subpaths. The plan is cacheable; it accepts any list — including intermediate shapes (interruptions).
canonicalD(MorphIconData icon) String
Canonical d attribute of an icon: a PathIcon's string verbatim, or a NodeIcon's real cubics quantized to 4 decimals.
cubicsToPathD(List<CubicPath> paths) String
Cubic subpaths → canonical d, quantized to 4 decimals.
dampingRatioOf(SpringConfig spring) double
ζ = c / (2√k): 1 is critically damped, below it overshoots, above it crawls.
fillPolyline(Path path, List<Float64List> subs, List<bool> closed) → void
Refills path with the sampled subpaths — the in-flight shape.
fitIcon(MorphIconData input, Object viewBox, [double grid = 24]) String
Re-grids an icon drawn on viewBox onto the shared grid (24 by default), centred and preserving aspect ratio — the SVG xMidYMid meet rule.
iconToCubics(MorphIconData input) List<CubicPath>
Icon (MorphIconData) → list of cubic subpaths.
interpLinear(MorphPlan plan, double t, List<Float64List> out) → void
Raw coordinate lerp (same correspondence, no decomposition).
interpPolar(MorphPlan plan, double t, List<Float64List> out) → void
parseSvgDocument(String source) SvgDocument
Parses an <svg> document into drawable geometry and its coordinate space.
resampleIcon(MorphIconData input, [int n = 64]) List<Sampled>
Full input pipeline: icon → cubics → sampled subpaths with their topology (the plan needs to know which subpaths are closed loops).
resamplePath(CubicPath path, [int n = 64, double? cornerThreshold]) Float64List
Samples a cubic subpath at n points equidistant by arc length, anchoring corners and endpoints as exact samples. Returns a Float64List(2n). Closed paths distribute n intervals around the loop (without duplicating the first point); the circular start-point freedom is resolved by the plan's circular correspondence.
resolveSpring({SpringPreset? preset, double? stiffness, double? damping, Duration? duration}) SpringConfig
Resolves a spring the way the web driver's resolveSpring does: a preset supplies the defaults, and either component may be overridden.
serialize(List<List<double>> subs, [List<bool>? closed]) String
Sampled subpaths → polyline d attribute. closed[k] appends Z to subpath k (closed loops in flight); without flags everything is open.
springForDuration(Duration duration, {SpringPreset? preset, double? dampingRatio}) SpringConfig
The spring that settles in duration while keeping a damping ratio of dampingRatio (default: the ratio of preset, or of snappy).
springSettleTime(SpringConfig spring) Duration
How long spring takes to settle from rest, by the criterion the driver actually uses. The inverse of springForDuration, and what pins it.
svgToIcon(String source, {bool fit = true, double grid = 24}) MorphIconData
An <svg> document → morphable icon data.

Typedefs

IconNode = List<IconEl>
Lucide-style icon data: a list of [tag, attrs] pairs.
IconNodeAttrs = Map<String, Object?>
Attributes of an icon node, as the icon packs export them: values may be strings or numbers, and an absent key means "use the fallback".

Exceptions / Errors

StrokeMorphError
Every error this library throws.