wood burning stoves
The moose likes Applets and the fly likes Animation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Animation" Watch "Animation" New topic


John Spindler

Joined: Feb 12, 2002
Posts: 28
Ok everybody I need some help. I am trying to do graphic animation. I read through all 4 of the HelloAnimThread exaples as you'll see in a min =), anyway my project involves having two text fields for the user to input a X and a Y coordinate then once they hit the "Move" button, the small image should as smoothly as possible move to that X,Y coordinate. If you can guess I am having a bit of trouble. In my code I've made use of the double buffering technique (and I don't know if this is a good idea or not) but I'm drawing the "onsite" image 50 pixels from the top of the Y axis to give me room for the text fields and the button. (One of the previous requirements was to add an image to a label and have that move around the screen, is that even possible?), Can anyone think of a better way of doing this? I would greatly appreciate it! Thanks!<br><br>
Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 424
I think, the starting point is good. I think that the smooth animation is to be done by
letting the thread 'sleep' for some time.
I tried to adjust your code, but succeeded (until now) only for the very first loading where a
'cursor' moved very smooth from one place to another. (now for me holydays start will be back in three weeks)
Peter Gragert
Ranch Hand

Joined: Jan 16, 2001
Posts: 424
Maybe this is nearby the solution you look for!
It moves the cursor rather smootly nearby the desired posistion.
Use the sleep time to adjust speed too?!
//I tried to obey the Cattledrive Styleguide
I agree. Here's the link: http://aspose.com/file-tools
subject: Animation
It's not a secret anymore!