psychic-ui 0.0.0
Loading...
Searching...
No Matches
psychic_ui::Timing Class Reference

#include <Timing.hpp>

Public Member Functions

template<class Rep, class Period>
constexpr Timing (std::chrono::duration< Rep, Period > duration, Ease ease=Ease::Standard)
constexpr Timing (Spring spring)
constexpr bool instant () const
constexpr bool isSpring () const
constexpr std::chrono::nanoseconds duration () const
constexpr const Ease & ease () const
constexpr const Spring & spring () const
constexpr bool keepsVelocity () const
Approach approach (float offset0, float velocity0, float seconds, float tolerance) const
constexpr bool operator== (const Timing &) const =default

Detailed Description

How a value moves to a new one: a duration along an easing curve, or a spring. The default timing, and a duration of 0, are instant.

Timing{150ms}                 // CSS's default curve
Timing{100ms, Ease::Out}
Timing{Spring::Snappy}

Member Function Documentation

◆ approach()

Approach psychic_ui::Timing::approach ( float offset0,
float velocity0,
float seconds,
float tolerance ) const
nodiscard

Where a value moving with this timing is, seconds after it had an offset of offset0 from its target and a velocity of velocity0: along the curve (from rest, whatever the velocity) or pulled by the spring. tolerance is how close a spring settles (a curve settles when its duration is over).

◆ instant()

bool psychic_ui::Timing::instant ( ) const
inlinenodiscardconstexpr

Whether values jump to their end: no duration and no spring

◆ keepsVelocity()

bool psychic_ui::Timing::keepsVelocity ( ) const
inlinenodiscardconstexpr

Whether a retarget keeps the velocity: a spring does, a curve starts from rest


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