• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Animation

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Ranch Hand
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!