Using JMathAnim as a Java library
Another way to use JMathAnim is by creating and running your own Java programs. Let us illustrate this with a simple example of setting up a project. In this example, we will use IntelliJ IDEA, although the process is similar in any other IDE.
First, create a Maven project:

The pom.xml file of the project has relevant information about it. Let's add this piece of code to declare the dependence:
<dependencies>
<dependency>
<groupId>com.github.davidgutierrezrubio</groupId>
<artifactId>jmathanim-core</artifactId>
<version>1.2.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Then click “Sync All Maven Projects” so that Maven downloads the required dependencies.
Next, create a class named FirstAnimation and make it extend the Scene2D class. The IDE will prompt you to implement the required abstract methods:
public class FirstAnimation extends Scene2D {
@Override
public void runSketch() throws Exception {
config.parseFile("#dark.xml");
Shape myCircle= Shape.circle();
play.showCreation(myCircle);
scene.waitSeconds(2);
}
public static void main(String[] args) {
FirstAnimation scene = new FirstAnimation();
scene.execute();
}
}
Run this class (for example, by pressing Ctrl+Shift+F10 or clicking the Run button in the gutter). A window will open showing a brief animation of a circle being created. After two seconds, the window will close automatically.
Your project is now ready to generate mathematical animations using JMathAnim. Enjoy!
