# Lottie Interactivity - how to sync to cursor while keeping the button pressed? (solved)

**URL:** <https://forum.lottiefiles.com/t/lottie-interactivity-how-to-sync-to-cursor-while-keeping-the-button-pressed-solved/2207>\
**Category:** Lottie Plugins\
**Created:** [February 3, 2022, 10:34am UTC](https://forum.lottiefiles.com/t/lottie-interactivity-how-to-sync-to-cursor-while-keeping-the-button-pressed-solved/2207 "2022-02-03T10:34:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![azaca](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.lottiefiles.com/azaca/32/224_2.png) [@azaca](https://forum.lottiefiles.com/u/azaca)\
**Post date:** [February 3, 2022, 10:34am UTC](https://forum.lottiefiles.com/t/lottie-interactivity-how-to-sync-to-cursor-while-keeping-the-button-pressed-solved/2207/1 "2022-02-03T10:34:01Z")

</div>

Hi there.

I got a Lottie-animation that is linked to the horizontal cursor position. So far that’s easily done using the Lottie Interactivity library. But now I want the animation to be synced to a dragging gesture, meaning I click and hold and while holding the animation changes depending on the cursors x-position.

That library offers a lot of options on how to interact with animations, but it doesn’t seem to feature something as described. So I assume the only option is to create that functionality manually? I guess I just watch for clicks on that object, and until I get a release I follow the cursor position, and match that to the frames in that animation?

Thanks for any advice

Edit: I now wrote a custom function for that, which takes the x-position of the cursor on drag start, measures the distance dragged, turns that into a percentage of the screen width, and converted that into a percentage of animation that needs to be played (if that is of help to anyone in the same situation)

---

<div class="post-metadata">

**Author:** ![irbypace](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.lottiefiles.com/irbypace/32/3165_2.png) [@irbypace](https://forum.lottiefiles.com/u/irbypace)\
**Post date:** [February 3, 2022, 3:20pm UTC](https://forum.lottiefiles.com/t/lottie-interactivity-how-to-sync-to-cursor-while-keeping-the-button-pressed-solved/2207/2 "2022-02-03T15:20:04Z")

</div>

Hey @azaca so it worked out? I know some of us would love to see the custom function and I would love to see the animation in context.
