跳转至

cf::ui::components::material::CFMaterialPropertyAnimation

Material Design 3 Property Animation. More...

#include <cfmaterial_property_animation.h>

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

Public Functions

Name
CFMaterialPropertyAnimation(float * value, float from, float to, int durationMs, base::Easing::Type easing =base::Easing::Type::EmphasizedDecelerate, QObject * parent =nullptr)
Constructor with property pointer.
~CFMaterialPropertyAnimation() override
Destructor.
CFMaterialPropertyAnimation(constCFMaterialPropertyAnimation & ) =delete
CFMaterialPropertyAnimation & operator=(constCFMaterialPropertyAnimation & ) =delete
CFMaterialPropertyAnimation(CFMaterialPropertyAnimation && ) =delete
CFMaterialPropertyAnimation & operator=(CFMaterialPropertyAnimation && ) =delete
virtual void start(Direction dir =Direction::Forward) override
Start the animation.
virtual void pause() override
Pause the animation.
virtual void stop() override
Stop the animation and reset to initial state.
virtual void reverse() override
Reverse the animation direction.
virtual bool tick(int dt) override
Update animation state by delta time.
virtual cf::WeakPtr< ICFAbstractAnimation > GetWeakPtr() override
Gets a weak pointer to this animation.
void setTargetWidget(QWidget * widget)
Set the target widget for repaint notifications.
float currentValue() const
Get the current value.

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)
bool getEnabled() const
Gets the enabled state of the animation.
void setTargetFps(float fps)
Set the target FPS for this animation.

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::material::CFMaterialPropertyAnimation;

Material Design 3 Property Animation.

Since: 0.1

Note: The property pointer must remain valid during animation.

Warning: None

Animates a float property from a start value to an end value following Material Design 3 motion specifications.

The animation uses:

  • Duration specified in milliseconds
  • Easing curve for smooth motion
  • Direct property update via pointer
// Create a property animation
float scale = 0.0f;
auto propAnim = std::make_unique<CFMaterialPropertyAnimation>(
    &scale, 0.0f, 1.0f, 200, Easing::Type::EmphasizedDecelerate, this);

// Connect to finished signal
connect(propAnim.get(), &CFMaterialPropertyAnimation::finished,
        this, [&scale]() {
    qDebug() << "Final scale:" << scale;
});

// Start the animation
propAnim->start();

Public Functions Documentation

function CFMaterialPropertyAnimation

CFMaterialPropertyAnimation(
    float * value,
    float from,
    float to,
    int durationMs,
    base::Easing::Type easing =base::Easing::Type::EmphasizedDecelerate,
    QObject * parent =nullptr
)

Constructor with property pointer.

Parameters:

  • value Pointer to the float property to animate. Must remain valid for the lifetime of this animation.
  • from Start value of the animation.
  • to End value of the animation.
  • durationMs Duration of the animation in milliseconds.
  • easing Easing type for the animation.
  • parent QObject parent.

Exceptions:

  • None

Since: 0.1

Note: The value pointer must remain valid for the lifetime of this animation.

Warning: None

function ~CFMaterialPropertyAnimation

~CFMaterialPropertyAnimation() override

Destructor.

Since: 0.1

function CFMaterialPropertyAnimation

CFMaterialPropertyAnimation(
    constCFMaterialPropertyAnimation & 
) =delete

function operator=

CFMaterialPropertyAnimation & operator=(
    constCFMaterialPropertyAnimation & 
) =delete

function CFMaterialPropertyAnimation

CFMaterialPropertyAnimation(
    CFMaterialPropertyAnimation && 
) =delete

function operator=

CFMaterialPropertyAnimation & operator=(
    CFMaterialPropertyAnimation && 
) =delete

function start

virtual void start(
    Direction dir =Direction::Forward
) override

Start the animation.

Parameters:

  • dir Direction to play the animation.

Since: 0.1

Reimplements: cf::ui::components::ICFAbstractAnimation::start

function pause

virtual void pause() override

Pause the animation.

Since: 0.1

Reimplements: cf::ui::components::ICFAbstractAnimation::pause

function stop

virtual void stop() override

Stop the animation and reset to initial state.

Since: 0.1

Reimplements: cf::ui::components::ICFAbstractAnimation::stop

function reverse

virtual void reverse() override

Reverse the animation direction.

Since: 0.1

Reimplements: cf::ui::components::ICFAbstractAnimation::reverse

function tick

virtual bool tick(
    int dt
) override

Update animation state by delta time.

Parameters:

  • dt Delta time in milliseconds.

Return: true if animation is still running, false if finished.

Since: 0.1

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

function GetWeakPtr

inline virtual cf::WeakPtr< ICFAbstractAnimation > GetWeakPtr() override

Gets a weak pointer to this animation.

Exceptions:

  • None

Return: WeakPtr to this animation.

Since: 0.1

Note: None

Warning: None

Reimplements: cf::ui::components::ICFAbstractAnimation::GetWeakPtr

Each concrete animation class must implement this using its WeakPtrFactory.

function setTargetWidget

void setTargetWidget(
    QWidget * widget
)

Set the target widget for repaint notifications.

Parameters:

  • widget Target widget (may be nullptr).

Exceptions:

  • None

Since: 0.1

Note: None

Warning: None

The widget receives update() calls during animation to trigger repaints.

function currentValue

inline float currentValue() const

Get the current value.

Return: Current animated value.

Since: 0.1


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