Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Animation

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic