deltaX is set to -1 why? It moves the image strip from right to left. If you change the sign of "dx" you can move the image from left to right.
What is clip.x??? "clip" is a Rectangle instance variable. Its location (x, y) is set in
paintComponent to position it at the center of the panel. To see what its affect is in the animation comment out the line "g2.setClip(clip);".
If this new position + the width of the image is less than clip.x??? If the end of the image has moved far enough to the left to no longer be visible inside the "clip" Rectangle, reset the value of "x" to start another pass from right to left.
make graphics2D g2 = to ??? what does this mean It casts the graphics context "g" from type Graphics to type Graphics2D. Graphics2D has more/fancier capabilities. Compare the api of the Graphics and Graphics2D classes to see the difference. To learn more about this see the
2D Graphics online tutorial trail.
set a new int called dx??? Which is given the value int dx = pos < 0 ? pos + imageWidth : pos - imageWidth; ??? What does this mean??? The easiest way to see what this does is to comment out the entire (enclosing
if statement) block and see what is different in the animation. It is a way to make the animation appear to be continuous.
What does dispose do??? Releases the system resources that were being used for the graphics context that was created for the BufferedImage.