A new AffineTransform
always has zero rotation. You are adding a 90-degree rotation, so every frame of your animation will look the same: the image rotated 90 degrees from its normal orientation.
You need to calculate the current rotation angle.
// Instance variable intialized at zero.
double angle = 0.0;
// In your ActionListener timer handler increment the angle.
{
angle += Math.toRadians(5); // 5 degrees per 100 ms = 50 degrees/second
while (angle > 2 * Math.pi())
angle -= 2 * Math.pi(); // keep angle in reasonable range.
}
public void paint(Graphics g) {
// Just use the transform that's already in the graphics.
Graphics2d g2 = (Graphics2d) g;
g2.setToIdentity();
// The code for your other transforms is garbled in my browser. Fill in here.
g2.rotate(angle);
g2.drawImage(arm, t, null);
}
Hope this gets you closer.
I'll add that 100 ms is pretty slow for a frame rate. The animation will look jerky. Smooth action needs at most 30 ms or 30 frames per second. Games that use the GPU sometimes run over 100 fps.
And you should avoid new
when possible inside the animation loop. It will require the garbage collector to run more frequently. This can cause a stutter in the animation.