1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Per-frame animation support for widget authors.
//!
//! Widgets that need to animate over time (e.g. a sliding fill, a fading transition) use two
//! primitives:
//!
//! - [`animation_frame_signal`] — a [`Signal<u32>`] that the platform increments once per frame
//! while at least one widget has requested an animation tick. Read it from `into_element` to
//! subscribe the component to frame events so the runtime re-renders on each tick.
//! - [`request_animation_frame`] — call this from `into_element` when the current animation has
//! not yet reached its target. The platform will call `request_redraw` and advance the frame
//! signal on the next `about_to_wait`.
//!
//! Both primitives are thread-local and single-window. They are intentionally low-level; a
//! higher-level `use_animation` hook is planned for v0.5.
use ;
use crateSignal;
thread_local!
/// Returns the shared frame-tick [`Signal<u32>`].
///
/// The platform increments this signal once per frame while animation is active. Call this from
/// `into_element` and read the returned signal to subscribe the current component to frame events:
///
/// ```ignore
/// if progress < 1.0 {
/// lemon::animation_frame_signal().get(); // subscribe
/// lemon::request_animation_frame(); // keep ticking
/// }
/// ```
/// Requests that the platform render one more frame and advance the animation clock.
///
/// Call this from `into_element` whenever your animation has not yet converged. The platform
/// will respond by incrementing [`animation_frame_signal`] and calling `request_redraw`, which
/// drives the reactive re-render needed to advance the interpolation.
/// Returns `true` if [`request_animation_frame`] has been called since the last
/// [`take_animation_pending`].
pub
/// Clears the pending flag and returns its previous value.
pub
/// Increments the frame signal by one, triggering a reactive re-render in any component that
/// subscribed to it via [`animation_frame_signal`].
pub