guillaume 2026.6.1
A C++ UI framework designed for modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
guillaume::theme::MotionScale Class Reference

The animation timings of a theme: one length per MotionDuration, plus which easing curve to use for which kind of movement. More...

#include <headers/guillaume/theme/tokens.hpp>

Public Member Functions

 MotionScale (void)
 Create the scale with the Material 3 baseline durations listed in MotionDuration.
float getDuration (MotionDuration duration) const
 Get the length of a duration token.
void setDuration (MotionDuration duration, float seconds)
 Replace the length of a duration token.

Static Public Member Functions

static constexpr motion::Easing standard (void)
 Get the easing for elements that move or change while staying on screen.
static constexpr motion::Easing enter (void)
 Get the easing for elements entering the screen: fast at first, then settling.
static constexpr motion::Easing exit (void)
 Get the easing for elements leaving the screen: slow at first, then speeding away.

Static Public Attributes

static constexpr float MaxFrameStep = 0.1f
 Longest frame step the animation system integrates, in seconds, so a stalled frame does not skip a whole transition.
static constexpr float IndeterminateCycle = 1.5f
 Duration of one cycle of an indeterminate progress or loading indicator, in seconds (1.5 s, as in react-native-paper).
static constexpr float SnackbarDuration = 7.0f
 How long a snackbar stays visible by default, in seconds (7 s, as in react-native-paper).

Detailed Description

The animation timings of a theme: one length per MotionDuration, plus which easing curve to use for which kind of movement.

The durations can be changed per theme; the constants and the three easing choices are the same for every theme.

const float seconds =
const float progress = motion::applyEasing(
theme::MotionScale::enter(), elapsed / seconds);
static constexpr motion::Easing enter(void)
Get the easing for elements entering the screen: fast at first, then settling.
Definition tokens.hpp:390
float getMotionDuration(theme::MotionDuration duration)
Get the length the active theme gives to a duration token.
See also
guillaume::Theme::getMotion
guillaume::motion::applyEasing

Definition at line 328 of file tokens.hpp.

Constructor & Destructor Documentation

◆ MotionScale()

guillaume::theme::MotionScale::MotionScale ( void )

Create the scale with the Material 3 baseline durations listed in MotionDuration.

Definition at line 126 of file tokens.cpp.

Member Function Documentation

◆ enter()

constexpr motion::Easing guillaume::theme::MotionScale::enter ( void )
inlinestaticconstexpr

Get the easing for elements entering the screen: fast at first, then settling.

Returns
motion::Easing::EmphasizedDecelerate.

Definition at line 390 of file tokens.hpp.

◆ exit()

constexpr motion::Easing guillaume::theme::MotionScale::exit ( void )
inlinestaticconstexpr

Get the easing for elements leaving the screen: slow at first, then speeding away.

Returns
motion::Easing::EmphasizedAccelerate.

Definition at line 400 of file tokens.hpp.

◆ getDuration()

float guillaume::theme::MotionScale::getDuration ( MotionDuration duration) const

Get the length of a duration token.

Parameters
durationThe duration token to look up.
Returns
The duration, in seconds.
Exceptions
std::out_of_rangeWhen duration is MotionDuration::Count.

Definition at line 132 of file tokens.cpp.

◆ setDuration()

void guillaume::theme::MotionScale::setDuration ( MotionDuration duration,
float seconds )

Replace the length of a duration token.

Parameters
durationThe duration token to change.
secondsThe new duration, in seconds; must be greater than 0.
Exceptions
std::out_of_rangeWhen duration is MotionDuration::Count.
std::invalid_argumentWhen seconds is zero or negative.

Definition at line 137 of file tokens.cpp.

◆ standard()

constexpr motion::Easing guillaume::theme::MotionScale::standard ( void )
inlinestaticconstexpr

Get the easing for elements that move or change while staying on screen.

Returns
motion::Easing::Standard.

Definition at line 380 of file tokens.hpp.

Here is the caller graph for this function:

Member Data Documentation

◆ IndeterminateCycle

float guillaume::theme::MotionScale::IndeterminateCycle = 1.5f
staticconstexpr

Duration of one cycle of an indeterminate progress or loading indicator, in seconds (1.5 s, as in react-native-paper).

Definition at line 341 of file tokens.hpp.

◆ MaxFrameStep

float guillaume::theme::MotionScale::MaxFrameStep = 0.1f
staticconstexpr

Longest frame step the animation system integrates, in seconds, so a stalled frame does not skip a whole transition.

Definition at line 335 of file tokens.hpp.

◆ SnackbarDuration

float guillaume::theme::MotionScale::SnackbarDuration = 7.0f
staticconstexpr

How long a snackbar stays visible by default, in seconds (7 s, as in react-native-paper).

Definition at line 347 of file tokens.hpp.


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