1

there is a way to accelerate a floatAnimator in delphi ? such as increase or decrease velocity of a sprite when a key is pressed ? thanks

Claude Brisson
  • 4,085
  • 1
  • 22
  • 30

1 Answers1

1

You could use duration property to change the speed. for example changing Duration from 1 to 0.5 will double the speed.

  • Thanks for the answer, I did it, but when the user presses the key at the beginning of the animation it works fine, but if it presses at the end it speeds up too much – Nilton Carvalho Jun 08 '20 at 22:23
  • it is because when you change the duration, the animation calculate current frame from **current_time/duration** and the new generated frame position is changed so much. you could use `Floatanimation.start;` after setting the duration to start it from beginning or set the duration in new variable and set it in OnProcess event when the currentTime=0 – Mohsen Vahabzadeh Jun 09 '20 at 05:42