bars
The 13 health bar styles as pure functions: `Bars.render(style, Bars.view(healthComp, smoothing?, compact?))` returns a widget tree. `Bars.STYLES` lists the names.
Lifeline.bars
The 13 health bar styles as pure functions: Bars.render(style, Bars.view(healthComp, smoothing?, compact?)) returns a widget tree. Bars.STYLES lists the names.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2bars — every Lifeline health bar style. Each style is a pure function from a view of one entity's health to a UI widget tree, so every style works the same way and a world swaps them by changing one string. local Bars = require("Lifeline.bars") local node = Bars.render("hearts", Bars.view(healthComp, smoothing, compact)) local w, h = Bars.metrics("hearts", view) -- for laying bars out A view is { frac, trail, sfrac, hasShield, hp, maxHp, sh, maxSh, name, t, hitAge, healAge, dying, compact, dead, low }. `compact = true` draws the small version that floats over an entity; false draws the big on-screen version.
px(n: number) → number
| arg | type | description |
|---|---|---|
| n | number |
box(style: any, children: any?) → any
| arg | type | description |
|---|---|---|
| style | any | |
| children | any? |
row(style: any, children: any?) → any
| arg | type | description |
|---|---|---|
| style | any | |
| children | any? |
text(s: string, style: any) → any
| arg | type | description |
|---|---|---|
| s | string | |
| style | any |
abs(x: number, y: number, w: number, h: number, style: any?, children: any?) → any
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| w | number | |
| h | number | |
| style | any? | |
| children | any? |
centered(x: number, y: number, w: number, h: number, child: any) → any
| arg | type | description |
|---|---|---|
| x | number | |
| y | number | |
| w | number | |
| h | number | |
| child | any |
track(w: number, h: number, style: any, children: any) → any
| arg | type | description |
|---|---|---|
| w | number | |
| h | number | |
| style | any | |
| children | any |
svg(markup: string, w: number, h: number) → any
| arg | type | description |
|---|---|---|
| markup | string | |
| w | number | |
| h | number |
hitFlash(d: any, strength: number) → number
A short, bright flash right after a hit, so a bar reads as being hit.
| arg | type | description |
|---|---|---|
| d | any | |
| strength | number |
hitShake(d: any, amp: number) → string
| arg | type | description |
|---|---|---|
| d | any | |
| amp | number |
hpColor(f: number) → string
| arg | type | description |
|---|---|---|
| f | number |
numbers(d: any) → string
| arg | type | description |
|---|---|---|
| d | any |
pct(f: number) → string
| arg | type | description |
|---|---|---|
| f | number |
lowPulse(d: any) → number
A soft glow that breathes when health is low.
| arg | type | description |
|---|---|---|
| d | any |
classic(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
segmented(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
ring(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
heartSvg(fill: string, stroke: string, shine: boolean) → string
| arg | type | description |
|---|---|---|
| fill | string | |
| stroke | string | |
| shine | boolean |
heart(size: number, f: number, full: string, empty: string, transform: string?) → any
| arg | type | description |
|---|---|---|
| size | number | |
| f | number | |
| full | string | |
| empty | string | |
| transform | string? |
hearts(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
boss(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
overhead(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
minimal(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
stacked(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
bar(w: number, h: number, f: number, trail: number, grad: string, empty: string, label: string?, glyph: any?) → any
| arg | type | description |
|---|---|---|
| w | number | |
| h | number | |
| f | number | |
| trail | number | |
| grad | string | |
| empty | string | |
| label | string? | |
| glyph | any? |
scifi(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
fantasy(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
gem(size: number) → any
| arg | type | description |
|---|---|---|
| size | number |
cartoon(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
pixel(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
orb(d: any) → any
| arg | type | description |
|---|---|---|
| d | any |
render(style: string, d: any) → any
Draw one health bar. `style` is one of Bars.STYLES (unknown names draw "classic").
| arg | type | description |
|---|---|---|
| style | string | |
| d | any |
has(style: string) → boolean
| arg | type | description |
|---|---|---|
| style | string |
metrics(style: string, d: any) → void
Approximate drawn size of a style, in UI points, for laying bars out so they do not overlap. `view` is a Bars.view.
| arg | type | description |
|---|---|---|
| style | string | |
| d | any |
view(comp: any, st: any?, compact: boolean?) → any
Build a view from a Health component plus optional smoothing state { shown, trail, hitT, healT } kept by the caller.
| arg | type | description |
|---|---|---|
| comp | any | |
| st | any? | |
| compact | boolean? |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.