# Configuring and Loading an Animation

#### <a class="anchor" id="bkmrk--1"></a>Candera Animation Concept

The following key concepts are required to run animations in a [Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]") application:

<div class="contents" id="bkmrk-candera%3A%3Aanimation%3A%3A"><div class="contents"><div class="textblock">- [Candera::Animation::AnimationPlayer](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_player.html "AnimationPlayer is an AnimationPlayerBase that animates AnimationBlendedProperties.") provides the control interfaces (use [Candera::Animation::AnimationGroupPlayer](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_group_player.html "AnimationGroupPlayer is an AnimationPlayerBase that controls a hierarchy of AnimationPlayerBase compo...") for animation groups)
- [Candera::Animation::AnimationTimeDispatcher](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_time_dispatcher.html "Dispatches world time (as received from an application) to a collection of AnmationPlayers.") dispatches the current world time to animations; animations can also query the current world time from the dispatcher
- [Candera::Animation::AnimationKeyframeSequence](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_keyframe_sequence.html "A KeyframeSequence that provides interpolation between keyframes.") configures proper animation values for each time point of an animation.
- [Candera::Animation::InterpolationStrategy](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_interpolation_strategy.html "InterpolationStrategy provides an interface for calculating the interpolated value of a KeyframeSeque...") specifies for a key frame sequence, how values between several key frames shall be calculated.
- [Candera::Animation::AnimationPropertySetter](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_property_setter.html "Base class for all animation property setters.") applies animation values to animated properties

</div></div></div>In SceneComposer, animations can be configured in the AnimationDesign view:

<div class="contents" id="bkmrk-create-a-new-animati"><div class="contents"><div class="textblock">- Create a new animation - <span style="color: rgb(230, 126, 35);">[New Animation](https://doc316en.candera.eu/books/animation-design/page/new-animation)</span> in SceneComposer User Manual
- Select a node property to animate - <span style="color: rgb(230, 126, 35);">[Add Animated Property](https://doc316en.candera.eu/books/animation-design/page/add-animated-property)</span> in SceneComposer User Manual
- Specify the key frame sequence including property values and interpolation strategy - <span style="color: rgb(230, 126, 35);">[Animation Values](https://doc316en.candera.eu/books/animation-design/page/animation-values-keyframes)</span> in SceneComposer User Manual

</div></div></div>It is also possible to import an animation to SceneComposer from a content generation tool via FBX format - <span style="color: rgb(230, 126, 35);">[How to Import Resources](https://doc316en.candera.eu/books/import-of-resources/page/how-to-import-resources)</span> in SceneComposer User Manual

#### <a class="anchor" id="bkmrk--2"></a>

#### <a class="anchor" id="bkmrk--3"></a>Configuring Animation Player

In the Player or in an application, the animation can be retrieved from the generated asset by specifying its [Candera](http://dev.doc.cgistudio.at/APILINK/namespace_candera.html "[DataBinding_RefTypeSample]") name (e.g. *MyModule#Animations#Animation*).

```
    AssetProvider* assetProvider = GetAssetProvider();
    m_animPlayer = assetProvider->GetAnimation(m_animName);
```

<div class="contents" id="bkmrk-in-scenecomposer-the"><div class="contents"><div class="contents"><div class="textblock"><div class="fragment">  
</div><dl class="note"><dt></dt><dd><p class="callout info">In SceneComposer the animation can be retrieved from AssetProvider only if it was previously loaded in the scene. A better way to access it directly is to define it as a widget property.</p>

</dd></dl><div class="fragment">  
</div></div></div></div></div>```
                // Define Animation property
                CdaProperty(Animation,Candera::Animation::AnimationPlayer::SharedPointer, GetAnimation, SetAnimation)
                    CdaDescription("Animation")
                <a class="code" href="http://dev.doc.cgistudio.at/APILINK/group___meta_info.html#ga119bef57449bd05d8b3c40d7d514e375">CdaPropertyEnd</a>()
                // End Define Animation property
```

Next, as already explained in <span style="color: rgb(230, 126, 35);">[Initializing AssetLoader and Animations](https://doc316en.candera.eu/link/418#bkmrk-initializing-assetlo-0)</span>, an instance of [Candera::Animation::AnimationTimeDispatcher](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_time_dispatcher.html "Dispatches world time (as received from an application) to a collection of AnmationPlayers.") is needed to provide current world time to animations.

For this, the new animation player must be added to the [Candera::Animation::AnimationTimeDispatcher](http://dev.doc.cgistudio.at/APILINK/class_candera_1_1_animation_1_1_animation_time_dispatcher.html "Dispatches world time (as received from an application) to a collection of AnmationPlayers.") instance maintained by the application.

```
        // Add player to time dispatcher

        Animation::AnimationTimeDispatcher::SharedPointer timeDispatcher = GetAnimationTimeDispatcher();
        if (timeDispatcher == 0) {
            return;
        }
        static_cast<void>(timeDispatcher->AddPlayer(m_animPlayer));

        // End Add player to time dispatcher
```

Now the animation player is ready to be used.