nCine::RotationAffector class

Affector that animates the rotation of a particle.

Linearly interpolates an angle offset between consecutive RotationStep entries; the offset is added to the particle's starting rotation.

Base classes

class ParticleAffector
Base class for all particle affectors.

Public types

struct RotationStep
An angle offset keyed to a normalized particle age.

Constructors, destructors, conversion operators

RotationAffector()
RotationAffector(RotationAffector&&) defaulted
Default move constructor.
RotationAffector(const RotationAffector& other) protected defaulted
Protected default copy constructor used to clone objects.

Public functions

auto operator=(RotationAffector&&) -> RotationAffector& defaulted
Default move assignment operator.
auto clone() const -> RotationAffector
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 addRotationStep(float age, float angle)
Appends a rotation step at the specified age.
auto steps() -> SmallVectorImpl<RotationStep>&
Returns the array of rotation steps.
auto steps() const -> const SmallVectorImpl<RotationStep>&
Returns the array of rotation steps (read-only).

Function documentation

void nCine::RotationAffector::affect(Particle* particle, float normalizedAge) override

Affects a property of the specified particle using a precomputed normalized age.

Parameters
particle Particle to mutate
normalizedAge Particle age mapped to the [0, 1] range, where 0 is birth and 1 is death

void nCine::RotationAffector::addRotationStep(float age, float angle)

Appends a rotation step at the specified age.

Steps must be added in ascending age order; an out-of-order step is rejected with a warning.