ice
library
Classes
-
FlakeDesign
-
Seeded snowflake design used by snowflake.
-
IcePane
-
A flat pane of ice managed by Panes.
-
Panes
-
Panes of ice: flat polygons that fly, spin and tumble end over end, bounce on the floor, skid, settle and fade.
Functions
-
blade(Painter p, double bx, double by, double tx, double ty, double w, List<int> c, {double a = 1.0, bool white = false, double glint = -1.0, double jag = -1.0, int dim = 0})
→ void
-
A jagged ice blade standing on its base
(bx, by), tip at (tx, ty), w wide at the base.
-
centroid(List<(double, double)> pts)
→ ({double area, double x, double y})
-
A polygon's centroid and area.
-
drawFractures(Painter p, List<List<(double, double, double)>> cracks, double reach, List<int> c, {double ox = 0.0, double oy = 0.0, bool hot = true, double a = 1.0})
→ void
-
Draw cracks grown out to distance
reach from their start.
-
endBy(double t, double duration, {Particles? ps, Bits? bits, Panes? panes})
→ void
-
Nothing outlives the effect: trims the life of every particle, bit and pane that would last past
duration.
-
flakeDesign(Rng r)
→ FlakeDesign
-
A snowflake design, seeded: pairs of side branches along each arm, optional hexagonal plate and forked tips.
-
fractures(Rng r, bool inside(double x, double y), double x, double y, int n, {(double, double) step = const (1.6, 2.6), int len = 18, double fork = 0.16, double? a0, double spread = tau})
→ List<List<(double, double, double)>>
-
Cracks racing out from
(x, y) through a shape.
-
glassPoly(Painter p, List<(double, double)> pts, int c, double a)
→ void
-
Fill a polygon with translucent color (true blending, no dither): glass, ice, light.
-
iceOf(int col, List<int> c)
→ int
-
A color turned to ice: its brightness picks a step of the ice ramp
c (dark to bright), never the darkest.
-
inPoly(List<(double, double)> pts, double x, double y)
→ bool
-
Is
(x, y) inside the polygon pts [(x, y), ...]? (even-odd rule)
-
snowflake(Painter p, double x, double y, double r, double rot, FlakeDesign d, List<int> c, {double a = 1.0, double hot = 0.0})
→ void
-
A six-armed snowflake of radius
r turned by rot, crisp 1 px lines.
-
splitPoly(List<(double, double)> pts, double x, double y, double a)
→ List<List<(double, double)>>
-
Cut a polygon along the line through
(x, y) at angle a: the pieces with three corners or more.