This was an interesting problem!
To make it automatic I did the following:
- I added a bone and a transform constraint that mimicks the rotating bone translation
- I then created a bone mimicking the bone in the previous constraint, but parented this bone to another bone with 0 scale so that it acts as a sort of shadow
- I constrainted the white part bone to follow this shadow bone so as not to be affected by the o scale
- Finishing touches were removing the translation keys, and turning that black piston into a mesh so that it shrinks a little where appropriate.
If you try to turn the wheel now, the rest will slide as expected! 😃