I don’t need help as I can achieve my goals with a walkaround, but I wanted to share this. Tomorrow I’ll take a look at anim-controller.js anyway.
Simple example:
We have a door that opens when we get close to it.
By manipulating the anim.speed parameter, we can control the speed it opens with the distance. The closer we are, the faster it opens.
With the same parameter, when we get far enough, speed becomes negative, and the door starts closing.
So far so good.
Problem is, if it opens completely (animation finishes), then even when we set up the speed negative, it doesn’t close.
4 things I’ve noticed:
- If we close it before it opens completely, we can open it again
- When it opens completely and it gets stuck, it still shows as being still in that activeState
- Even when stuck, _controller._timeInState is responsive, but the animation just ignores it
- If we close the door for too long, later the door will take a long time to open again (until _controller._timeInState > 0). I don’t think this was intended.
Function reset restarts the full graph, so it’s not the best solution
We can play with _controller.play , but is not clean
You can achieve similar results with more complex graphs.