psychic-ui 0.0.0
Loading...
Searching...
No Matches
psychic_ui::Animated< T > Class Template Reference

#include <Animation.hpp>

Public Member Functions

 Animated (Div *owner, T value, Timing timing={})
 Animated (const Animated &)=delete
Animated & operator= (const Animated &)=delete
 Animated (Animated &&)=delete
Animated & operator= (Animated &&)=delete
Animated & to (T target)
Animated & jump (T value)
Animated & timing (Timing timing)
const Timing & timing () const
T value () const
const T & target () const
bool animating () const

Detailed Description

template<Interpolable T>
class psychic_ui::Animated< T >

A value that moves to its targets with a timing instead of jumping, for what a component draws itself (style properties have transition). Keep it as a member of the div it belongs to:

Animated<float> _offset{this, 0.0f, Timing{200ms, Ease::Out}};

_offset.to(row.y());         // From where it is now
float y = _offset.value();   // In draw()

Its owner's window advances it every frame (Window::updateAnimations) and draws while it moves. It jumps when its owner isn't in a window, or the window reduces motion. It ends with its owner, the window only holds it weakly.

Member Function Documentation

◆ animating()

template<Interpolable T>
bool psychic_ui::Animated< T >::animating ( ) const
inlinenodiscard

Whether it is on its way

◆ jump()

template<Interpolable T>
Animated & psychic_ui::Animated< T >::jump ( T value)
inline

Set the value at once

◆ target()

template<Interpolable T>
const T & psychic_ui::Animated< T >::target ( ) const
inlinenodiscard

Where it goes

◆ timing()

template<Interpolable T>
Animated & psychic_ui::Animated< T >::timing ( Timing timing)
inline

How the next to moves (a theme's motion token, read in styleUpdated); a move in progress keeps its own

◆ to()

template<Interpolable T>
Animated & psychic_ui::Animated< T >::to ( T target)
inline

Move to target from the current value (a spring keeps its velocity)

◆ value()

template<Interpolable T>
T psychic_ui::Animated< T >::value ( ) const
inlinenodiscard

Where it is, as of the window's last updateAnimations


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