.. _animation: Animating Blender properties ============================ Setting a keyframe ------------------ Animating an object in Blender comes down to setting some keyframes to the properties of that object. The function :py:func:`~ddg.visualization.blender.animation.set_keyframe` is designed for this purpose. In this example the location of a tetrahedron is animated: .. literalinclude:: ../../../../examples/blender/docs/animation/basic_animation.py :lines: 1-9 .. image:: animation_location.gif Additionaly, one can add animation to the rotation property of the tetrahedron in a similar way: .. literalinclude:: ../../../../examples/blender/docs/animation/basic_animation.py :lines: 12-15 .. image:: animation_rotation.gif Clearing the animation data --------------------------- To clear the animation data that was set on the properties of an object, one can run: .. literalinclude:: ../../../../examples/blender/docs/animation/basic_animation.py :lines: 18-20 .. image:: animation_still.png Setting multiple keyframes at the same time ------------------------------------------- When the animation becomes more complex one might want to set the values of a property in multiple frames at the same time. Running this code block would have the same effect as the two first code blocks: .. literalinclude:: ../../../../examples/blender/docs/animation/basic_animation.py :lines: 23-33 .. image:: animation_rotation.gif For even more complex animations, one can set multiple frames to multiple properties. This code block sets the animation for the location and the scaling at the same time: .. literalinclude:: ../../../../examples/blender/docs/animation/basic_animation.py :lines: 36-46 .. image:: animation_scaling.gif