Constructor
new TextCounter(field)
Animates a numeric value and formats it as bitmap text.
Parameters:
| Name | Type | Description |
|---|---|---|
field |
rune.text.BitmapField | Target field, retained but not owned. |
- Source:
Members
(readonly) running :boolean
Whether the value is being animated.
Type:
- boolean
- Source:
value :number
Current raw numeric value. Assigning a finite number stops animation and
displays it immediately. The default formatter rounds to the nearest integer.
Type:
- number
- Source:
Methods
complete() → {undefined}
Jumps to the target and invokes onComplete once if running.
- Source:
Returns:
- Type
- undefined
dispose() → {undefined}
Releases the tween, callback and formatter without disposing the field.
- Source:
Returns:
- Type
- undefined
onComplete(func, scopeopt) → {undefined}
Registers or clears a completion callback receiving the field.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
func |
function | Callback, or null to clear it. | |
scope |
Object |
<optional> |
Callback execution scope. |
- Source:
Returns:
- Type
- undefined
setFormatter(func, scopeopt) → {undefined}
Sets a formatter receiving the raw numeric value and returning display text.
Passing null restores integer formatting. Refreshes the field immediately.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
func |
function | Formatter, or null for rounded integer text. | |
scope |
Object |
<optional> |
Formatter execution scope. |
- Source:
Returns:
- Type
- undefined
stop() → {undefined}
Stops at the current value without invoking onComplete.
- Source:
Returns:
- Type
- undefined
to(value, durationopt) → {undefined}
Animates from the current value to a finite target using an SDK linear tween.
Stops other text animations. Zero duration and an unchanged target complete
immediately. Retargeting starts at the current raw value, without a jump.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
value |
number | The target numeric value. | ||
duration |
number |
<optional> |
600 | Duration in milliseconds, clamped to zero. |
- Source:
Returns:
- Type
- undefined