This is how I would do forward / back animation according to what you want here: https://playcanvas.com/project/1000392/overview/forwardback-animation
You can use that as a base and work out how best to listen/check if it’s hit the middle frame to stop the current state animation. Personally, I would do it as a state machine which checks with stage of the animation it’s in and what the user wants to do.
eg states of going from first frame to middle, middle to end frame, end frame to middle, middle to first, first frame to end, end to first