API reference
data-* attributes
A body is configured entirely in markup. Each force reads only the attributes it uses and ignores the rest, so you can set a few and compose freely.
All attributes
-
data-bodytokens - Space-separated force ids — required to make an element a body. Forces compose.
-
data-strengthnumber · default 0.5 - Force magnitude S.
-
data-rangepx · default 280 - Influence radius d_max.
-
data-spinnumber · default 1 - Sign/strength of rotation — swirl, charge, magnetism, lens.
-
data-angledeg · default 0 - Heading — stream, jet, gate, shear, align.
-
data-colorhex - Accent override on engage, and the carried colour for pigment.
-
data-whencondition · default '' - Gate the force on a condition: active, fast, slow, hot, cool, scrolling.
-
data-feedbackflag - Opt into two-way density write-back (the --d custom property).
-
data-shapedflag - Shaped source — forces reference the nearest point on the element box, so matter shells the shape instead of bunching at its centre.
-
data-absorbpx · default 64 - Capture radius for the sink force.
-
data-maxnumber · default 60 - Load at which a sink supernovas (releases).
-
data-fmin / data-fmaxnumber - Variable-font weight range that --d drives on a feedback body.
-
data-opsznumber - Optical-size axis to drive alongside weight.
-
data-active"1" - Engagement state — set automatically on hover/focus of a [data-hot] element.
-
data-presetname - Expand a preset into several co-located bodies — blackhole, galaxy, tornado, …
Which force reads which
Beyond the universal data-body / data-when / data-feedback,
each force reads this subset (declared in the catalog):
-
attract -
repel -
swirl -
stream -
viscosity -
jet -
tether -
wall -
sink
-
gravity -
charge -
magnetism -
thermal -
collide -
diffuse -
propagate -
memory
-
lens -
gate -
buoyancy -
shear -
crystallize -
align -
wind -
cohesion -
pressure -
hunt -
spawn -
link -
morph -
resonate -
spotlight -
pigment -
fieldflow
What the field writes back
Reciprocity has two halves: bodies bend the field through data-*, and the field
bends them back through CSS custom properties. A body that opts in (data-feedback)
receives these on its element — read them in your own CSS to make type glow, cards lift, or a
meter fill. The write target is the element itself, or a body's writeTarget.
--d on data-feedback The body's own gathered density ∈ [0,1], eased. The canonical reaction var.
--forces-density on data-feedback Explicit alias of --d (the namespaced name; same value).
--forces-heatmap-density on data-feedback + heatmap The ambient heatmap density under the body ∈ [0,1] — where matter pools around it, distinct from --d.
--load / --mass on sink body A sink’s accretion fill fraction ∈ [0,1] (--mass is a back-compat alias).
--lit on causality Spillover-lit density when a saturated neighbour bleeds density across a boundary.