The final value the counter should reach.
The Angular writable signal that will be updated during the animation.
Optionalduration: number = 1000The total duration of the animation in milliseconds. Defaults to 1000ms (1 second).
Optionalsteps: number = 30The number of animation steps. Higher values result in smoother but more frequent updates.
The interval timer ID, which can
be used to cancel the animation using clearInterval().
Smoothly animates a numeric signal from 0 up to a target value over a given duration.
This function creates an interval-based animation that increments a number in small steps until it reaches the target. It’s useful for counters, stats, or any UI element where you want a smooth counting animation.