# Using custom functions in custom animations

**URL:** https://forum.pinegrow.com/t/using-custom-functions-in-custom-animations/10646
**Category:** Pinegrow Interactions Add-on
**Created:** [April 22, 2025, 11:36pm UTC](https://forum.pinegrow.com/t/using-custom-functions-in-custom-animations/10646 "2025-04-22T23:36:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![reflex](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@reflex](https://forum.pinegrow.com/u/reflex)
#### Post date: [April 22, 2025, 11:36pm UTC](https://forum.pinegrow.com/t/using-custom-functions-in-custom-animations/10646/1 "2025-04-22T23:36:32Z")

</div>

I’m attempting to create a “look-at” behaviour for items, where the items follow the cursor when inside their shared container.

I know how to do the calculations for the required rotation, but I can’t get the javascript atan (or atan2) functions to be recognised in the interactions editor.

Is there a trick to this? Alternatively, it is possible to call a manually defined js function from interactions?

At the moment I’m at the stage of simply setting the rotation to a fixed value (e.g. atan(0.5)) but it does nothing.

---

<div class="post-metadata">

### Author: ![Riccarcharias](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/riccarcharias/32/4051_2.png) [@Riccarcharias](https://forum.pinegrow.com/u/Riccarcharias)
#### Post date: [April 23, 2025, 7:59am UTC](https://forum.pinegrow.com/t/using-custom-functions-in-custom-animations/10646/2 "2025-04-23T07:59:59Z")

</div>

If you want to trigger a JS function with Pinegrow Interaction you can use “Interaction \> Call function (on complete)”. Just type in the name of your function.

---

<div class="post-metadata">

### Author: ![reflex](https://avatars.discourse-cdn.com/v4/letter/r/f05b48/32.png) [@reflex](https://forum.pinegrow.com/u/reflex)
#### Post date: [April 23, 2025, 10:22am UTC](https://forum.pinegrow.com/t/using-custom-functions-in-custom-animations/10646/3 "2025-04-23T10:22:36Z")

</div>

By Jove. It works!

For others who have the same question, adding a few more details to @Riccarcharias posting.

The option is where you are choosing to add a parameter when in _Edit Animation \> Edit Transition \> Add parameter_. Down the bottom of the list of options is _Interactions \> Call function_. I went with the “on update” option.

In there, you insert the name of your function (without parenthesis). It will call your function with parameters of the target element and the progress [0…0.1]. In your function you can make any changes you desire.
