This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hello everybody. Does anybody have any ideas how to make animated zoom. What I mean by this is how to make zooming slowly showing how it is zooming not at once. Any ideas? Thanks.(:
From your question, I'm assuming that you already know how to zoom, just not how to animate it. Use a javax.swing.Timer and change the zoom level over a period of time, calling repaint() each time.
luck, db
There are no new questions, but there may be new answers.
Bobby Marvikuan
Ranch Hand
Joined: Mar 14, 2012
Posts: 54
posted
0
Darryl Burke wrote:From your question, I'm assuming that you already know how to zoom, just not how to animate it. Use a javax.swing.Timer and change the zoom level over a period of time, calling repaint() each time.
Thanks for answering So, I should change zoom level inside the action performed method inside of action Listener of the timer or no? and a question what should I put inside that method if the answer is no. Cause I tried to play around with it and it did not do what I wanted it to(
Bobby Marvikuan
Ranch Hand
Joined: Mar 14, 2012
Posts: 54
posted
0
Darryl Burke wrote:From your question, I'm assuming that you already know how to zoom, just not how to animate it. Use a javax.swing.Timer and change the zoom level over a period of time, calling repaint() each time.
here is my code first one does not run at all and the second one increase but very quickly(
Why do you start the Timer inside a while(...) loop?
Bobby Marvikuan
Ranch Hand
Joined: Mar 14, 2012
Posts: 54
posted
0
Darryl Burke wrote:Why do you start the Timer inside a while(...) loop?
It is stupid I know but I have read in the API that it stops before starting doing smth. So, I thought this is what I need because it will stop every time the I "increase my zoom" but it does not change anything if I put it outside
if you still have a problem, note that very few people will read 700 lines of code.
you'd be better off creating another program that just zooms a circle or square,
include your timer code (or perhaps a JSlider with listener), and if it still doesn't work
post that code (should be about 30 to 40 lines long), and when you find the solution
you can incorporate it into your 700 line program.