AnimationNode¶
-
class
rlogic
::
AnimationNode
: public rlogic::LogicNode¶ Animation node can be used to animate properties in logic network. Animation node itself is a logic node and has a set of input and output properties:
Fixed inputs:
progress (float) - point within [0;1] normalized range of where to jump to in the animation
in this range 0 marks the time 0 (regardless of timestamp of the first keyframe), and 1 marks the end of the animation determined by the duration of the animation
values outside of the [0;1] range are accepted and will be clamped
Fixed outputs:
duration (float) - total duration of the animation, determined by the highest timestamp from all its channels
is affected by modifications to timestamp data via properties (see rlogic::AnimationNodeConfig::setExposingOfChannelDataAsProperties)
Channel outputs: Each animation channel provided at creation time (rlogic::LogicEngine::createAnimationNode) will be represented as output property with name of the channel (rlogic::AnimationChannel::name) and a value of type matching element in rlogic::AnimationChannel::keyframes. Channel value output is a result of keyframes interpolation based on the ‘progress’ input above, it can be linked to another logic node input to use the animation result.
Channel data inputs (only if created with rlogic::AnimationNodeConfig::setExposingOfChannelDataAsProperties enabled):
channelsData (struct) - contains all channels and their data in a hierarchy. For each channel:
[channelName] (struct)
timestamps (array of float) - each element represents a timestamp value
keyframes (array of T) - each element represents a keyframe value
type T is data type matching this channel original keyframes
During update when ‘progress’ input is set the following logic is executed:
calculate local animation time based on progress
for each channel:
lookup closest previous and next timestamp/keyframe pair according to the local animation time,
interpolate between them according to the interpolation type of that channel,
and finally set this value to the channel’s output property.
Note that all channel outputs will always have a value determined by corresponding keyframes, this includes also when the time falls outside of the first/last animation timestamps:
channel output value equals first keyframe for any time at or before the first keyframe timestamp
channel output value equals last keyframe for any time at or after the last keyframe timestamp This can be useful for example when needing to initialize the outputs before playing the animation yet, when updating the animation node with progress 0, the logic will execute and update outputs to their first keyframes.
Public Functions
-
AnimationNode
(std::unique_ptr<internal::AnimationNodeImpl> impl) noexcept¶ Constructor of AnimationNode. User is not supposed to call this - AnimationNodes are created by other factory classes
- Parameters
impl
: implementation details of the AnimationNode
-
~AnimationNode
() noexcept override¶ Destructor of AnimationNode.
-
const AnimationChannels &
getChannels
() const¶ Returns channel data used in this animation (as provided at creation time rlogic::LogicEngine::createAnimationNode).
Note that the retrieved data is not affected by any modifications via channel data input properties (see rlogic::AnimationNodeConfig::setExposingOfChannelDataAsProperties). If modifications were made, only corresponding properties hold the actual values used during animation.
- Return
animation channels used in this animation.
-
AnimationNode
(const AnimationNode &other) = delete¶ Copy Constructor of AnimationNode is deleted because AnimationNodes are not supposed to be copied
- Parameters
other
: AnimationNodes to copy from
-
AnimationNode
(AnimationNode &&other) = delete¶ Move Constructor of AnimationNode is deleted because AnimationNodes are not supposed to be moved
- Parameters
other
: AnimationNodes to move from
-
AnimationNode &
operator=
(const AnimationNode &other) = delete¶ Assignment operator of AnimationNode is deleted because AnimationNodes are not supposed to be copied
- Parameters
other
: AnimationNodes to assign from
-
AnimationNode &
operator=
(AnimationNode &&other) = delete¶ Move assignment operator of AnimationNode is deleted because AnimationNodes are not supposed to be moved
- Parameters
other
: AnimationNodes to assign from
Public Members
-
internal::AnimationNodeImpl &
m_animationNodeImpl
¶ Implementation of AnimationNode