Background on track 1.
Front image track 2.
Mask track 3.
Animate track 2 how you want it to behave, make sure it stays within the mask.
If you cannot see the front image properly lower the opacity of the mask temporarily a bit. Just to show through.
Now nest track 2 and add Track Matte effect to this nested sequence.
Set Track Matte effect to track 3.
Thank you but I already tried this and is not working.
The area masked keeps moving together with the front image, even when aplying the changes before the matte effect.
The animation cannot be in the same timeline it needs to be nested so:
and finally add mask to nested sequence in main timeline.
in that order it should work.
Thank you so much
Nesting was the solution to my problem