게임 만들기

HealthBar

Lightweight DOM health bar that animates width updates.

HealthBar

Lightweight DOM health bar that animates width updates.

Examples

const bar = new HealthBar({ maxValue: 200 });
document.body.appendChild(bar.element);
bar.setValue(150);

Members

setValue

setValue(value: number): void

Sets the current value and updates the DOM representation.

element

element: HTMLDivElement

Root DOM element you can insert anywhere in your HUD.