Skip to main content

refresh_animated

Function refresh_animated 

Source
pub fn refresh_animated(animation: u64)
Expand description

As refresh, inside withAnimation — see ease_in_out.

Examples found in repository?
examples/todo.rs (line 47)
40fn add() {
41    let text = draft().get();
42    if text.trim().is_empty() {
43        return;
44    }
45    items().lock().unwrap().push(Item { title: text, done: false });
46    draft().set(String::new());
47    state::refresh_animated(state::ease_in_out(0.25));
48}
More examples
Hide additional examples
examples/dashboard.rs (line 95)
85fn refresh() {
86    static SEED: AtomicU64 = AtomicU64::new(0x9E37_79B9);
87    for slot in &LOAD {
88        let mut x = SEED.load(Ordering::Relaxed);
89        x ^= x << 13;
90        x ^= x >> 7;
91        x ^= x << 17;
92        SEED.store(x, Ordering::Relaxed);
93        slot.store(x % 101, Ordering::Relaxed);
94    }
95    state::refresh_animated(state::ease_in_out(0.6));
96}
examples/swift_org_tutorial.rs (line 170)
163fn try_again() {
164    SELECTED.store(random(ACTIVITIES.len()), Ordering::Relaxed);
165    COLOR.store(random(COLORS.len()), Ordering::Relaxed);
166    ID.fetch_add(1, Ordering::Relaxed);
167    // Writing the `@State` inside `withAnimation` is what makes SwiftUI
168    // interpolate: the body re-runs, `.id()` sees a new identity, and the old
169    // card slides out while the new one slides in.
170    state::refresh_animated(state::ease_in_out(1.0));
171}