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

#include <Tween.hpp>

Public Member Functions

 Tween (const Channels &value, std::size_t count=4)
void jump (const Channels &value)
void retarget (const Channels &target, const Timing &timing, std::optional< std::chrono::nanoseconds > start)
bool advance (std::chrono::nanoseconds now)
void finish ()
const Channels & value () const
const Channels & target () const
const Channels & velocity () const
bool running () const
const Timing & timing () const

Detailed Description

The motion of up to four channels toward a target, with a timing: along an easing curve for its duration, or pulled by a spring until it settles. Time is a monotonic clock's reading (Window::updateAnimations).

A retarget starts from the current value: a curve takes its whole duration again, a spring keeps its velocity.

Member Function Documentation

◆ advance()

bool psychic_ui::Tween::advance ( std::chrono::nanoseconds now)

Move to where it is at now

Returns
Whether it still moves

◆ finish()

void psychic_ui::Tween::finish ( )

Go to the target at once

◆ jump()

void psychic_ui::Tween::jump ( const Channels & value)

At rest on a value

◆ retarget()

void psychic_ui::Tween::retarget ( const Channels & target,
const Timing & timing,
std::optional< std::chrono::nanoseconds > start )

Head to target from the current value, starting at start, or at the first advance without one. An instant timing jumps.


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