17 #ifndef INTERPOLATIONLOGIC_H
18 #define INTERPOLATIONLOGIC_H
24 #include "audio/SoundEffectInstance.h"
208 virtual void init()
override;
213 virtual void update()
override;
260 void resolveTargetAndProperty();
262 QVariant getInterpolatedValue(
int primitiveType);
263 void updateInterpolatingSound();
265 QObject* mUnresolvedTarget =
nullptr;
266 QString mUnresolvedTargetProperty;
269 QString mTargetNonPrimitiveProperty;
272 float mForwardDuration = 1.0f;
273 float mBackwardDuration = 1.0f;
274 bool mHasSmoothing =
false;
275 float mSmoothing = 0.0f;
277 Behavior mBehavior = Bidirectional;
282 const static QSet<int> sValidPrimitiveTypes;
283 const static QSet<int> sValidNonPrimitiveTypes;
287 #endif // INTERPOLATIONLOGIC_H
QVariant endValue
Value at which to end the interpolation of target's targetProperty.
Definition: InterpolationLogic.h:58
void forwardDurationChanged()
Emitted when forwardDuration changes.
void interpolatingSoundChanged()
Emitted when interpolatingSound changes.
float getBackwardDuration() const
Returns backwardDuration.
Definition: InterpolationLogic.h:161
State state
Current state of the interpolation.
Definition: InterpolationLogic.h:81
An instance of a sound effect.
Definition: SoundEffectInstance.h:36
QVariant getBeginValue() const
Returns beginValue.
Definition: InterpolationLogic.h:134
void setBeginValue(QVariant value)
Sets beginValue.
float forwardDuration
Time, in seconds, over which to perform the InterpolationLogic::Forward interpolation.
Definition: InterpolationLogic.h:63
virtual void update() override
Performs an Engine::TIME_STEP_S based step in the interpolation if state is not InterpolationLogic::P...
QString interpolatingSound
Name of sound asset to play and loop while interpolating.
Definition: InterpolationLogic.h:86
void setState(State value)
Sets state.
void targetChanged()
Emitted when target changes.
float backwardDuration
Time, in seconds, over which to perform the InterpolationLogic::Backward interpolation.
Definition: InterpolationLogic.h:69
void setSmoothing(float value)
Sets smoothing.
void setInterpolatingSound(const QString &value)
Sets interpolatingSound.
void setTarget(QObject *value)
Sets target.
void setBackwardDuration(float value)
Sets backwardDuration.
void backwardDurationChanged()
Emitted when backwardDuration changes.
float getSmoothing() const
Returns smoothing.
Definition: InterpolationLogic.h:170
QVariant beginValue
Value at which to start the interpolation of target's targetProperty.
Definition: InterpolationLogic.h:54
void beginValueChanged()
Emitted when beginValue changes.
virtual void init() override
Resolves target and targetProperty.
Abstract base class for events which can be handled by Triggers.
Definition: Trigger.h:68
QObject target
Target object whose targetProperty value will be interpolated.
Definition: InterpolationLogic.h:45
QString targetProperty
Q_PROPERTY of target whose value will be interpolated.
Definition: InterpolationLogic.h:50
const QString & getTargetProperty() const
Returns targetProperty.
Definition: InterpolationLogic.h:125
QVariant getEndValue() const
Returns endValue.
Definition: InterpolationLogic.h:143
Non-visual entities in the QML item tree that define behavior for their parent Actor.
Definition: Logic.h:31
void setEndValue(QVariant value)
Sets endValue.
void stateChanged()
Emitted when state changes.
void endValueChanged()
Emitted when endValue changes.
Interpolation is currently paused, not changing targetProperty on update().
Definition: InterpolationLogic.h:96
void setTargetProperty(const QString &value)
Sets targetProperty.
const QString & getInterpolatingSound() const
Returns interpolatingSound.
Definition: InterpolationLogic.h:188
State getState() const
Returns state.
Definition: InterpolationLogic.h:179
InterpolationLogic(QObject *parent=nullptr)
Constructs an InterpolationLogic.
QObject * getTarget() const
Returns target.
Definition: InterpolationLogic.h:116
Interpolates target's targetProperty value between beginValue and endValue.
Definition: InterpolationLogic.h:39
void smoothingChanged()
Emitted when smoothing changes.
Currently interpolating targetProperty from beginValue to endValue.
Definition: InterpolationLogic.h:100
void setForwardDuration(float value)
Sets forwardDuration.
State
State of the interpolation.
Definition: InterpolationLogic.h:92
Currently interpolating targetProperty from endValue to beginValue.
Definition: InterpolationLogic.h:104
float smoothing
Factor between linear and smooth interpolation.
Definition: InterpolationLogic.h:77
float getForwardDuration() const
Returns forwardDuration.
Definition: InterpolationLogic.h:152
void targetPropertyChanged()
Emitted when targetProperty changes.