Try the last formula I gave in post #6

Testing here, making animation to prove it.
It works.