|
TachyonUI 0.1.0
High-performance UI for building tools.
|
Tracks in-progress visual state transitions per element ID. More...
#include <gui_controls/gui_transition_manager.h>
Classes | |
| struct | Blend |
| A running transition: the states it blends between, and how far it is (eased). More... | |
Public Member Functions | |
| void | OnStateChange (ID id, ElementState fromState, ElementState toState, float elapsedSecs) |
| Starts (or retargets) the element's transition, timed by TimingFor. | |
| void | OnStateChange (ID id, ElementState fromState, ElementState toState, TransitionTiming timing, float elapsedSecs) |
| As above, with its own timing. | |
| void | OnStateSeen (ID id, ElementState state, ElementState watched, float elapsedSecs) |
| For an element whose watched bits change between frames rather than with input (Selected for ElementFlags::AnimatesSelected, Invalid), each frame it's built: when one differs from the frame before, the change runs, with kToggle for Selected and kInvalid for Invalid. | |
| bool | IsWatched (ID id) const |
| True when OnStateSeen saw the element the frame before or this one. | |
| std::optional< Blend > | Find (ID id, float elapsedSecs) const |
| The element's running transition, or nothing when it has none. | |
| TransitionState | Resolve (ID id, VisualBoxStyleIndex base, ElementState currentState, float elapsedSecs) const |
| The style indices and blend for the element's box base in currentState; fromStyleIndex == toStyleIndex and blendT == 1 when not transitioning. | |
| void | Purge (float elapsedSecs) |
| Once a frame, after the build: removes transitions that have ended and forgets what OnStateSeen saw of elements that weren't built this frame. | |
| void | Clear () |
| Removes all active transitions, for instance after a reorder invalidates ID mappings. | |
| void | SetEnabled (bool enabled) |
| Test/debug seam: when disabled, states snap instantly (deterministic rendering). | |
| bool | IsEnabled () const |
| True unless SetEnabled(false) was called. | |
| void | SetReducedMotion (bool reduced) |
| Reduced motion: every change is instant. Turning it on drops the active transitions. | |
| bool | IsReducedMotion () const |
Static Public Member Functions | |
| static TransitionTiming | TimingFor (ElementState fromState, ElementState toState) |
| The timing of a change from fromState to toState. | |
Static Public Attributes | |
| static constexpr TransitionTiming | kHoverIn { 0.070f, Easing::EaseOut } |
| static constexpr TransitionTiming | kHoverOut { 0.140f, Easing::EaseOut } |
| static constexpr TransitionTiming | kRelease { 0.120f, Easing::EaseOut } |
| static constexpr TransitionTiming | kFocus { 0.100f, Easing::EaseOut } |
| static constexpr TransitionTiming | kToggle { 0.120f, Easing::EaseInOut } |
| a switch, check box or radio turning on or off | |
| static constexpr TransitionTiming | kInvalid { 0.150f, Easing::EaseOut } |
| the invalid halo growing in | |
Tracks in-progress visual state transitions per element ID.
Times are seconds on the application's elapsed-time clock.
|
static |
The timing of a change from fromState to toState.
When several states change at once, the press counts first, then the hover, then the focus.
| void tachyon::TransitionManager::OnStateChange | ( | ID | id, |
| ElementState | fromState, | ||
| ElementState | toState, | ||
| float | elapsedSecs ) |
Starts (or retargets) the element's transition, timed by TimingFor.
| void tachyon::TransitionManager::OnStateChange | ( | ID | id, |
| ElementState | fromState, | ||
| ElementState | toState, | ||
| TransitionTiming | timing, | ||
| float | elapsedSecs ) |
As above, with its own timing.
| void tachyon::TransitionManager::OnStateSeen | ( | ID | id, |
| ElementState | state, | ||
| ElementState | watched, | ||
| float | elapsedSecs ) |
For an element whose watched bits change between frames rather than with input (Selected for ElementFlags::AnimatesSelected, Invalid), each frame it's built: when one differs from the frame before, the change runs, with kToggle for Selected and kInvalid for Invalid.
An element that wasn't built the frame before starts without one.
|
inline |
True when OnStateSeen saw the element the frame before or this one.
The element's running transition, or nothing when it has none.
| TransitionState tachyon::TransitionManager::Resolve | ( | ID | id, |
| VisualBoxStyleIndex | base, | ||
| ElementState | currentState, | ||
| float | elapsedSecs ) const |
The style indices and blend for the element's box base in currentState; fromStyleIndex == toStyleIndex and blendT == 1 when not transitioning.
| void tachyon::TransitionManager::Purge | ( | float | elapsedSecs | ) |
Once a frame, after the build: removes transitions that have ended and forgets what OnStateSeen saw of elements that weren't built this frame.
|
inline |
Removes all active transitions, for instance after a reorder invalidates ID mappings.
|
inline |
Test/debug seam: when disabled, states snap instantly (deterministic rendering).
Disabling drops the active transitions.
|
inline |
True unless SetEnabled(false) was called.
|
inline |
Reduced motion: every change is instant. Turning it on drops the active transitions.
|
inline |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
a switch, check box or radio turning on or off
|
staticconstexpr |
the invalid halo growing in