A progress bar for any long-running operation (downloads, uploads, decompression, loading).
Two modes:
- Determinate — assign
progress(0..1); the fill tweens smoothly to the new value (smoothing = falsesnaps instead). - Indeterminate — set
indeterminate = truefor unknown-length work; an accent band sweeps the track until turned off.
Layout follows the labelled-row convention (label left, optional percent, bar right); an empty label makes the bar span the full width. Idle-free by construction: a per-frame ticker runs only while the sweep animation or a smoothing tween is active, so a settled bar performs zero work.
Constructor
new(label:String, width:Float, progress:Float = 0)
Parameters:
label | the row text on the left (empty = the bar spans the whole row) |
|---|---|
width | layout width |
progress | the initial progress 0..1 |
Variables
showPercent:Bool = false
Renders a right-aligned percent readout beside the bar (hidden while indeterminate).
Methods
localize(key:String, fallback:String):Void
Switches the label to a localized string.
Parameters:
key | the translation key |
|---|---|
fallback | the source-language text |
setProgress(value:Float, animate:Bool = true):Void
Sets the progress with explicit control over animation.
Parameters:
value | the target progress 0..1 (clamped) |
|---|---|
animate |
|
inlinesetRatio(done:Float, total:Float):Void
Convenience for byte/item counters.
Parameters:
done | the amount completed |
|---|---|
total | the total amount (<= 0 switches to indeterminate) |