Vote count:
0
I am trying to implement animations when zooming a picture - that is to make some frames and display them with a timer so it seems that the picture is mooving to the zoom area. The thing is that I dont have any idea how to do it.
if (e.getSource() == timer) {
currentFrame++;
int newImageWidth = ((mandel.getWidth() - selection.width) / frames) ;
int newImageHeight = ((mandel.getHeight() - selection.height)/frames) ;
BufferedImage resizedImage = new BufferedImage(newImageWidth , newImageHeight, BufferedImage.TYPE_INT_RGB);
Graphics2D g = resizedImage.createGraphics();
g.scale(newImageWidth, newImageHeight);
g.drawImage(mandelImage, 0, 0, mandel.getWidth(), mandel.getHeight(), null);
g.dispose();
mandelImage = resizedImage;
mandel.repaint();
if (currentFrame >= frames) {
timer.stop();
recreate();//the final result on the zoom
}
asked 29 secs ago
Animated Zood im a picture
Aucun commentaire:
Enregistrer un commentaire