# Play part of the animation

**URL:** <https://discourse.threejs.org/t/play-part-of-the-animation/66018>\
**Category:** Questions\
**Tags:** r3f, animation\
**Created:** [May 27, 2024, 7:34am UTC](https://discourse.threejs.org/t/play-part-of-the-animation/66018 "2024-05-27T07:34:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kalabedo](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kalabedo/32/43091_2.png) [@kalabedo](https://discourse.threejs.org/u/kalabedo)\
**Post date:** [May 27, 2024, 7:34am UTC](https://discourse.threejs.org/t/play-part-of-the-animation/66018/1 "2024-05-27T07:34:53Z")

</div>

Hi there,

i made a mesh with an animation in Blender. Loading the model and playing that animation in threejs works perfect. I havent been using the AnimationMixer at all before. I cant find a solution of playing only a part of the animation with a specified duration.  
Lets say i always want the Animation to last 2 seconds. The full Animation from Blender plays in 30FPS in 2 seconds → 60FPS. What if i now want to play half of the Animation but also in 2 seconds. I know that i can set the duration to 4 then but how do i stop the animation half way in?

Here is a small codesandbox in r3f that i use for testing. Just a cube with a 120 degree rotation animation:

[https://codesandbox.io/p/devbox/animationtest-9qs5zl?file=%2Fsrc%2FComponents%2FTestCube.jsx%3A7%2C56](https://codesandbox.io/p/devbox/animationtest-9qs5zl?file=%2Fsrc%2FComponents%2FTestCube.jsx%3A7%2C56)

Can somebody explain me how i can achieve that or give some hints on what methods i should dig into?

Greetings  
Tom

---

<div class="post-metadata">

**Author:** ![seanwasere](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/seanwasere/32/20864_2.png) [@seanwasere](https://discourse.threejs.org/u/seanwasere)\
**Post date:** [May 27, 2024, 7:40am UTC](https://discourse.threejs.org/t/play-part-of-the-animation/66018/2 "2024-05-27T07:40:13Z")

</div>

Try [AnimationUtils.subclip](https://threejs.org/docs/#api/en/animation/AnimationUtils.subclip)

Example,

> **[AnimationUtils.subclip (R3F Version)](https://editor.sbcode.net/fbdc25522493cd004c26a454255bc201cfa9cb7b)**
>
> Trimming an animation clip with AnimationUtils.subclip

---

<div class="post-metadata">

**Author:** ![kalabedo](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/kalabedo/32/43091_2.png) [@kalabedo](https://discourse.threejs.org/u/kalabedo)\
**Post date:** [May 27, 2024, 8:02am UTC](https://discourse.threejs.org/t/play-part-of-the-animation/66018/3 "2024-05-27T08:02:53Z")

</div>

Exactly what i was looking for, thanks for the hint!!

Updated the Sandbox:

[https://codesandbox.io/p/devbox/animationtest-9qs5zl?file=%2Fsrc%2FComponents%2FTestCube.jsx%3A22%2C36](https://codesandbox.io/p/devbox/animationtest-9qs5zl?file=%2Fsrc%2FComponents%2FTestCube.jsx%3A22%2C36)
