Wavelength
Privacy-focused, cross-platform, and open-source communication application
Loading...
Searching...
No Matches
BlobState Class Referenceabstract

Abstract base class defining the interface for different blob animation states. More...

#include <blob_state.h>

Inheritance diagram for BlobState:
Collaboration diagram for BlobState:

Public Member Functions

virtual void Apply (std::vector< QPointF > &control_points, std::vector< QPointF > &velocity, QPointF &blob_center, const BlobConfig::BlobParameters &params)=0
 Applies the state-specific logic and effects to the blob. This method is called periodically by the animation loop to update the blob's appearance or behavior based on the current state (e.g., applying idle wave effect).
 
virtual void ApplyForce (const QVector2D &force, std::vector< QPointF > &velocity, QPointF &blob_center, const std::vector< QPointF > &control_points, double blob_radius)=0
 Applies an external force to the blob, potentially modified by the current state. Allows states to react differently to external forces (e.g., inertia from window movement).
 
virtual ~BlobState ()=default
 Virtual destructor. Ensures proper cleanup when deleting derived state objects through a base class pointer.
 

Detailed Description

Abstract base class defining the interface for different blob animation states.

This class serves as the foundation for specific state implementations (e.g., Idle, Moving, Resizing). Each derived class must implement the Apply() and ApplyForce() methods to define the behavior and physics modifications specific to that state.

Constructor & Destructor Documentation

◆ ~BlobState()

virtual BlobState::~BlobState ( )
virtualdefault

Virtual destructor. Ensures proper cleanup when deleting derived state objects through a base class pointer.

Member Function Documentation

◆ Apply()

virtual void BlobState::Apply ( std::vector< QPointF > & control_points,
std::vector< QPointF > & velocity,
QPointF & blob_center,
const BlobConfig::BlobParameters & params )
pure virtual

Applies the state-specific logic and effects to the blob. This method is called periodically by the animation loop to update the blob's appearance or behavior based on the current state (e.g., applying idle wave effect).

Parameters
control_pointsReference to the vector of current control point positions (can be modified).
velocityReference to the vector of current control point velocities (can be modified).
blob_centerReference to the blob's center position (can be modified).
paramsBlob appearance parameters (read-only).

Implemented in IdleState, MovingState, and ResizingState.

◆ ApplyForce()

virtual void BlobState::ApplyForce ( const QVector2D & force,
std::vector< QPointF > & velocity,
QPointF & blob_center,
const std::vector< QPointF > & control_points,
double blob_radius )
pure virtual

Applies an external force to the blob, potentially modified by the current state. Allows states to react differently to external forces (e.g., inertia from window movement).

Parameters
forceThe external force vector to apply.
velocityReference to the vector of current control point velocities (modified).
blob_centerReference to the blob's center position (modified).
control_pointsReference to the vector of current control point positions (read-only, used for calculations).
blob_radiusThe current average radius of the blob (read-only, used for calculations).

Implemented in IdleState, MovingState, and ResizingState.


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