[SOLVED] Manipulate entity dependent on current time of animation

So I’m hoping to get this done by tomorrow otherwise I would keep tinkering with it and wait to ask for help. Basically I have the animation playing backwards or forwards depending on whether the user is pressing the ui button.

Specifically I want to play two sounds. One gets louder as you approach the beginning and the other one as you approach the end of the animation. Likewise I would like the material on the character to be dark and semi transparent at the start of the animation and as it reaches the end it will be glowing white and fully opaque.

The tricky part is that it has to follow the user input or the direction of the character.

As the app launches the character is close to the middle of the animation traveling towards the beginning of the animation so ideally the sound is a faint mix of the opposite sounds and its material would be between dark /semi transparent and fully glowing white/opaque…ie grayish color

Clear as mud?

https://playcanvas.com/editor/scene/844491

Thanks in advance

There’s an attribute for current time on the animation component and also duration of the animation.

If you divide current time by duration, that will give you a normalised value between 0 and 1. 0 being the start of the animation and 1 being the end.

You can use that to help set the volume of the two sound effects/audio and also the opacity of the material(s)

Thank you @Yaustar