I just started learning the basics of the Graphics2D class. For now, I can draw different objects and implement them ActionListenerto actually move them to the screen onKeyPress. So far so good, although I was thinking about making something more complicated. I want to pass the path to my object and animate it only along this particular path.
Something like that, I will draw a line in the sky, and the plane should adhere to this drawn line and keep it alone on this particular line. Is it now possible?
I don’t need any code, but a few different methods or ideas will allow me to start working on this. Visualize my idea as shown below.
Starting point:

End point:

, , ( ) ( )
, java, Path2D GeneralPath. - , .