Play animation on button press

Can I have help how to get the coin flip animation to loop play for a few seconds with t from -1 to 1?

You can probably do this using a sine function, since this naturally oscillates between -1 and 1. However, it would be useful to know what the end game is - do you just want the animation to play for a few seconds, or do you need it to end specifically on a -1 or 1, do you need it to be the same length of time each time, etc.?

Describe how you envisage this operating and we can probably come up with a solution.

Animate for the same few seconds each time and end randomly on a -1 or 1, like a coin being flipped.