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

Tracks the running transitions of the elements' state channels. More...

#include <gui_controls/gui_transition_manager.h>

Public Member Functions

void OnStateChange (ID id, ElementState fromState, ElementState toState, float elapsedSecs)
 The element's state went from fromState to toState: each channel that changed starts toward it, or turns around, in its 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, its channel runs, Selected in kToggle.
bool IsWatched (ID id) const
 True when OnStateSeen saw the element the frame before or this one.
std::optional< float > Value (ID id, TransitionChannel channel, float elapsedSecs) const
 How far on (0 to 1) the element's channel is while it runs; nothing when it doesn't.
bool IsRunning (ID id) const
 True while one of the element's channels runs.
bool HasRunning () const
 True while any element's channel runs.
TransitionState Resolve (ID id, VisualBoxStyleIndex base, ElementState currentState, float elapsedSecs) const
 The element's box base in currentState: the styles of the states its running channels are between, each by how far they are (at most StyleBlend::kMaxStyles, the heaviest), or its current style alone.
void Purge (float elapsedSecs)
 Once a frame, after the build: lets go of the channels that have ended, and of the elements without one; forgets what OnStateSeen saw of elements not 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 (TransitionChannel channel, bool on)
 The timing of channel turning on, or off.

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 the running transitions of the elements' state channels.

Each channel goes from off (0) to on (1) or back on its own timing; one that turns around mid-way carries on from where it is. Only elements with a channel running take a slot, in a compact array, and only they are looked at each frame. Times are seconds on the application's elapsed-time clock.

Member Function Documentation

◆ TimingFor()

TransitionTiming tachyon::TransitionManager::TimingFor ( TransitionChannel channel,
bool on )
static

The timing of channel turning on, or off.

Selected is instant here; a toggle's part (OnStateSeen) turns in kToggle.

◆ OnStateChange()

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

The element's state went from fromState to toState: each channel that changed starts toward it, or turns around, in its timing.

Disabled changes at once.

◆ 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, its channel runs, Selected in kToggle.

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.

◆ Value()

std::optional< float > tachyon::TransitionManager::Value ( ID id,
TransitionChannel channel,
float elapsedSecs ) const

How far on (0 to 1) the element's channel is while it runs; nothing when it doesn't.

◆ IsRunning()

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

True while one of the element's channels runs.

◆ HasRunning()

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

True while any element's channel runs.

◆ Resolve()

TransitionState tachyon::TransitionManager::Resolve ( ID id,
VisualBoxStyleIndex base,
ElementState currentState,
float elapsedSecs ) const

The element's box base in currentState: the styles of the states its running channels are between, each by how far they are (at most StyleBlend::kMaxStyles, the heaviest), or its current style alone.

◆ Purge()

void tachyon::TransitionManager::Purge ( float elapsedSecs)

Once a frame, after the build: lets go of the channels that have ended, and of the elements without one; forgets what OnStateSeen saw of elements not 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: