1

Im creating animation of circle in JavaFX. A user inputs variables like angle and power of throw and my task was to create trajectory of this and make animation of thrown circle. Already I did trajectory and with that Im able to get final position of circle, but I still need to do animation of cricle trajectory. Im calculating the whole trajectory in loop and then draw curve.

Circle on the left is before throw and the right one is after this action. How can I animate this circle with trajectory already drawn? https://i.imgur.com/HlxQD8r.png

for(x = 0; x < Z; x=x+0.01){
         y = x * Math.tan(angleRadians) - (gSpeed/mianownik) * Math.pow(x, 2); // some variables to calculate y position
         y = 0 - y; //negation the real y position cause its kinda reverted
         gc.strokeLine(x+10, y+100, x+10,y+100); // drawing line; +10 and +100 because (10, 100) is circle starting position
 }
 gc.fillOval(x,y+100,20,20); // drawing cricle after throw
Piwko
  • 11
  • 1
  • In this great post you will fine all you need to know in order to make the animation https://stackoverflow.com/a/21399030/4167500 and pay attention on the final statement/sentence of that post. – JKostikiadis Nov 29 '17 at 23:24

0 Answers0