Path Animation
JavaFX provides us very neat and
easy way to do animation. A path animation creates a path for an object to move
on. Basically it tells the object where to start moving, how will it moves and
when it should stop moving. Lets see a simple example on path animation so we
can have a clear understanding of how it works.
Example
Click here to
download the example
The example above, we first
created a circle with an initial start position. Then we create a path for the
circle. The path determines the movement of the circle, then we create an
animation for the circle using the PathTransition. A click of the button cause
the animation to start.
Example
Click here to
download the example
In this example, we create two objects a
circle and a rectangle. then we assign different path and different animation to
each objects. Then a click of a button cause the objects to animate.
<JavaFX> <Home>