It’s image2 you need to keep in front.
The following might work
image2.setOpacity(1-.01*frameN%2)
You might be able to put 1-.01*frameN%2 in the image component instead of in code.
If opacity doesn’t work, try doing the same to the x coordinate.