let count = signal!(0); ui! { text { text_fmt!("Count: {}", bind!(count)) } button(label = "+", on_click = move || count.update(|n| *n += 1)) }
let opacity = AnimatedValue::new(1.0_f32); opacity.bind(box_ref, AnimProp::Opacity); // On click: opacity.animate( TweenTo::new(target, Duration::from_millis(300)).ease_out() );
tween_x.animate( TweenTo::new(120.0, Duration::from_millis(600)).ease_in_out() ); spring_x.animate( SpringTo::new(120.0).stiffness(140.0).damping(12.0) );
// Three values, three properties, one click. opacity.animate(TweenTo::new(1.0, Duration::from_millis(700)).ease_out()); scale.animate(SpringTo::new(1.0).stiffness(170.0).damping(22.0)); translate_y.animate(SpringTo::new(0.0).stiffness(170.0).damping(22.0));
let color = AnimatedValue::new((0.353, 0.310, 0.812, 1.0)); color.bind_color(stage_ref, AnimProp::BackgroundColor); color.animate( TweenTo::new(next_rgba, Duration::from_millis(500)).ease_in_out() );