animate to center

animate to center

My goal is to have two squares to emerge from the left and right of the screen and meet in the center. And stay there.The squares need to cover the whole screen.
Imagine standing in front of an elevator, and having both doors close in front of you. Thats what Im trying to do.
Can someone please help? when i animate the squares to move right/left by _px, if you resize the screen, a gap appears.