PositionAffector class
#include <nCine/Graphics/ParticleAffectors.h>
Affector that animates the position of a particle.
Linearly interpolates a position offset between consecutive PositionStep entries and moves the particle by the resulting amount.
Base classes
- class ParticleAffector
- Base class for all particle affectors.
Public types
- struct PositionStep
- A position offset keyed to a normalized particle age.
Constructors, destructors, conversion operators
- PositionAffector()
- PositionAffector(PositionAffector&&) defaulted
- Default move constructor.
- PositionAffector(const PositionAffector& other) protected defaulted
- Protected default copy constructor used to clone objects.
Public functions
- auto operator=(PositionAffector&&) -> PositionAffector& defaulted
- Default move assignment operator.
- auto clone() const -> PositionAffector
- Returns a copy of this object.
- void affect(Particle* particle, float normalizedAge) override
- Affects a property of the specified particle using a precomputed normalized age.
- void addPositionStep(float age, float posX, float posY)
- Appends a position step at the specified age.
- void addPositionStep(float age, Vector2f position)
- Appends a vector position step at the specified age.
- auto steps() -> SmallVectorImpl<PositionStep>&
- Returns the array of position steps.
- auto steps() const -> const SmallVectorImpl<PositionStep>&
- Returns the array of position steps (read-only).
Function documentation
void nCine:: PositionAffector:: addPositionStep(float age,
float posX,
float posY)
Appends a position step at the specified age.
Steps must be added in ascending age order; an out-of-order step is rejected with a warning.