leptos_animate 0.1.15

Animation utilities for Leptos. FLIP, in/out transitions, and helpers for custom animations.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use leptos::prelude::{GetValue, SetValue, StoredValue};

pub struct Initial(StoredValue<bool>);

impl Initial {
    pub fn new() -> Self {
        Self(StoredValue::new(true))
    }

    pub fn get(&self) -> bool {
        if self.0.get_value() {
            self.0.set_value(false);
            true
        } else {
            false
        }
    }
}