TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::TransitionManager Class Reference

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

Detailed Description

Tracks in-progress visual state transitions per element ID.

Times are seconds on the application's elapsed-time clock.

Member Function Documentation

◆ TimingFor()

TransitionTiming tachyon::TransitionManager::TimingFor ( ElementState fromState,
ElementState toState )
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.

◆ OnStateChange() [1/2]

void tachyon::TransitionManager::OnStateChange ( ID id,
ElementState fromState,
ElementState toState,
float elapsedSecs )

Starts (or retargets) the element's transition, timed by TimingFor.

◆ OnStateChange() [2/2]

void tachyon::TransitionManager::OnStateChange ( ID id,
ElementState fromState,
ElementState toState,
TransitionTiming timing,
float elapsedSecs )

As above, with its own timing.

◆ OnStateSeen()

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.

◆ IsWatched()

bool tachyon::TransitionManager::IsWatched ( ID id) const
inline

True when OnStateSeen saw the element the frame before or this one.

◆ Find()

std::optional< Blend > tachyon::TransitionManager::Find ( ID id,
float elapsedSecs ) const

The element's running transition, or nothing when it has none.

◆ Resolve()

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.

◆ Purge()

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.

◆ Clear()

void tachyon::TransitionManager::Clear ( )
inline

Removes all active transitions, for instance after a reorder invalidates ID mappings.

◆ SetEnabled()

void tachyon::TransitionManager::SetEnabled ( bool enabled)
inline

Test/debug seam: when disabled, states snap instantly (deterministic rendering).

Disabling drops the active transitions.

◆ IsEnabled()

bool tachyon::TransitionManager::IsEnabled ( ) const
inline

True unless SetEnabled(false) was called.

◆ SetReducedMotion()

void tachyon::TransitionManager::SetReducedMotion ( bool reduced)
inline

Reduced motion: every change is instant. Turning it on drops the active transitions.

◆ IsReducedMotion()

bool tachyon::TransitionManager::IsReducedMotion ( ) const
inline

Member Data Documentation

◆ kHoverIn

TransitionTiming tachyon::TransitionManager::kHoverIn { 0.070f, Easing::EaseOut }
staticconstexpr

◆ kHoverOut

TransitionTiming tachyon::TransitionManager::kHoverOut { 0.140f, Easing::EaseOut }
staticconstexpr

◆ kRelease

TransitionTiming tachyon::TransitionManager::kRelease { 0.120f, Easing::EaseOut }
staticconstexpr

◆ kFocus

TransitionTiming tachyon::TransitionManager::kFocus { 0.100f, Easing::EaseOut }
staticconstexpr

◆ kToggle

TransitionTiming tachyon::TransitionManager::kToggle { 0.120f, Easing::EaseInOut }
staticconstexpr

a switch, check box or radio turning on or off

◆ kInvalid

TransitionTiming tachyon::TransitionManager::kInvalid { 0.150f, Easing::EaseOut }
staticconstexpr

the invalid halo growing in


The documentation for this class was generated from the following file: