跳转至

cf::ui::components::ICFSpringAnimation

Spring-based animation interface. More...

#include <spring_animation.h>

Inherits from cf::ui::components::ICFAbstractAnimation, QObject

Public Functions

Name
ICFSpringAnimation(constbase::Easing::SpringPreset & easing, QObject * parent =nullptr)
Constructor with spring easing preset.
virtual void setTarget(float target)
Sets the target value for the spring animation.
virtual void setInitialVelocity(float velocity)
Sets the initial velocity for the spring animation.
virtual float currentValue() const =0
Gets the current animated value.
virtual bool tick(int dt) override
Updates the spring animation state.

Protected Attributes

Name
base::Easing::SpringPreset easing_
Spring easing preset containing physics parameters (stiffness, damping).
float m_position
Current position value in the spring animation.
float m_velocity
Current velocity value in the spring animation.
float m_target
Target value for the spring animation to settle at.

Additional inherited members

Public Types inherited from cf::ui::components::ICFAbstractAnimation

Name
enum class State { Idle, Running, Paused, Finished}
Animation states.
enum class Direction { Forward, Backward}
Animation playback direction.

Public Signals inherited from cf::ui::components::ICFAbstractAnimation

Name
void started()
Signal emitted when animation starts.
void paused()
Signal emitted when animation is paused.
void stopped()
Signal emitted when animation stops.
void reversed()
Signal emitted when animation reverses direction.
void finished()
Signal emitted when animation finishes.
void progressChanged(float progress)
Signal emitted when animation progress changes.

Public Functions inherited from cf::ui::components::ICFAbstractAnimation

Name
ICFAbstractAnimation(QObject * parent =nullptr)
virtual void start(Direction dir =Direction::Forward) =0
Starts the animation in the specified direction.
virtual void pause() =0
Pauses the animation.
virtual void stop() =0
Stops the animation and resets to initial state.
virtual void reverse() =0
Reverses the animation direction.
virtual cf::WeakPtr< ICFAbstractAnimation > GetWeakPtr() =0
Gets a weak pointer to this animation.
bool getEnabled() const
Gets the enabled state of the animation.
void setTargetFps(float fps)
Set the target FPS for this animation.
int calculateInterval() const
Calculate the timer interval based on target FPS.

Protected Functions inherited from cf::ui::components::ICFAbstractAnimation

Name
void setEnabled(bool enabled)
Sets the enabled state of the animation.

Protected Attributes inherited from cf::ui::components::ICFAbstractAnimation

Name
QTimer * driven_internal_timer
float m_progress
State m_state
float targetFps_
Target FPS for this animation (default 60.0f)

Friends inherited from cf::ui::components::ICFAbstractAnimation

Name
class ICFAnimationManagerFactory(ICFAnimationManagerFactory )

Detailed Description

class cf::ui::components::ICFSpringAnimation;

Spring-based animation interface.

Since: 0.1

Base class for animations that use spring physics for natural, bouncy motion following Material Design 3.

Public Functions Documentation

function ICFSpringAnimation

inline ICFSpringAnimation(
    constbase::Easing::SpringPreset & easing,
    QObject * parent =nullptr
)

Constructor with spring easing preset.

Parameters:

  • easing Spring preset for physics parameters.
  • parent QObject parent.

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

function setTarget

inline virtual void setTarget(
    float target
)

Sets the target value for the spring animation.

Parameters:

  • target Target value to animate toward.

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

function setInitialVelocity

inline virtual void setInitialVelocity(
    float velocity
)

Sets the initial velocity for the spring animation.

Parameters:

  • velocity Initial velocity value.

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

function currentValue

virtual float currentValue() const =0

Gets the current animated value.

Exceptions:

  • None

Return: Current animated value.

Since: 0.1

Note: None

Warning: None

function tick

virtual bool tick(
    int dt
) override

Updates the spring animation state.

Parameters:

  • dt Time elapsed since last tick (milliseconds).

Exceptions:

  • None

Return: true if animation continues, false if finished.

Since: 0.1

Note: None

Warning: None

Reimplements: cf::ui::components::ICFAbstractAnimation::tick

Uses springStep for physics-based interpolation.

Protected Attributes Documentation

variable easing_

base::Easing::SpringPreset easing_;

Spring easing preset containing physics parameters (stiffness, damping).

variable m_position

float m_position = 0.0f;

Current position value in the spring animation.

variable m_velocity

float m_velocity = 0.0f;

Current velocity value in the spring animation.

variable m_target

float m_target = 1.0f;

Target value for the spring animation to settle at.


Updated on 2026-03-09 at 10:14:00 +0000