Components / CountUp
CountUp
A number that counts up when it first shows on screen.
Example
The component itself, running in WebAssembly, beside its code in a playground. Try it.
Code
use ravenrs::prelude::*;
fn count_up() -> impl View {
HStack::new((
VStack::new((
Text::new("ROWS").style(TextStyle::Caption).foreground(Semantic::InkMuted),
CountUp::new(100_000.0),
))
.spacing(4.0),
VStack::new((
Text::new("COMPONENTS").style(TextStyle::Caption).foreground(Semantic::InkMuted),
CountUp::new(160.0).format(|v| format!("{v:.0}+")),
))
.spacing(4.0),
))
.spacing(48.0)
}