Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Animation.currentRateProperty Becomes Negative

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have implemented this example from Intro To Java Programming - Liang. The animation is reversing direction on me, but it should not be doing that. It has a button to pause the animation, and a label to display the current rate. Here's what I do that causes the problem:

1. Press the Pause button

2. Change the rate (using the arrow keys)

3. Press the Pause button (this resumes the animation)

4. Change the rate again - this causes the direction to reverse!

The rate is always set to a positive value. When the animation reverses, I notice that currentRateProperty has become negative. It is a read-only property, and nothing I do can make it positive again.

 
Rancher
Posts: 387
30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure if changing the rate of a running animation is a supported feature or not. The animation documentation doesn't say that you can't do it, but there are similar restrictions on Timelines that you can't change keyframes of executing timelines, so maybe changing the rate of a running animation is something that you shouldn't do either. I suggest you file a bug report in the JavaFX issue tracker to have somebody investigate.

Your sample seems to work if you stop the animation before you make the rate change and then start it again (from where its previous progress position) after the rate change has been made:

 
Get me the mayor's office! I need to tell him about this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic