Two masks on one layer

I’m trying to display a shape using a mask in a way that it unhides the shape from left to center and in the same time from right to center.

–shape–
—><—

Is there a way to create a mask layer that animates two masks or to create two masks above one layer?