Skip to content
Java animation framework based on CAAT
JavaScript Java Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Java animation framework based on CAAT

This project is a JAVA conversion of CAAT, a great Javascript framework. The goal of CAATJA, is to be used by any Java drawing/rendering technology that supports or gives a canvas API similar to HTML5 Canvas.

Thus CAATJA alone, is useless. You must have an implementation. There are 2 implementations : one in GWT (caatja-gwt) and the other one in JAVA FX (caatja-fx).

You can see CAATJA in action here :

Code example with caatja-fx

package com.katspow.example;

import com.katspow.caatja.behavior.BaseBehavior;
import com.katspow.caatja.behavior.BehaviorListener;
import com.katspow.caatja.behavior.RotateBehavior;
import com.katspow.caatja.behavior.ScaleBehavior;
import com.katspow.caatja.behavior.listener.BehaviorExpiredListener;
import com.katspow.caatja.core.Caatja;
import com.katspow.caatja.core.canvas.CaatjaCanvas;
import com.katspow.caatja.core.canvas.CaatjaColor;
import com.katspow.caatjafx.CaatjaFx;

import javafx.application.Application;
import javafx.stage.Stage;

public class Example extends Application {

	private CaatjaCanvas canvas;
	private Director director;

	public void start(Stage primaryStage) throws Exception {

		// Init some Caatja stuff
		CaatjaFx.init(320, 240, primaryStage, null);
		canvas = Caatja.createCanvas();
		director = new Director();
		director.initialize(320, 240, canvas);

		// Let's create a scene
		Scene scene = director.createScene();

		// Let's create a red square of 60x60
		ShapeActor square = new ShapeActor();
		square.setSize(60, 60);

		// Let's place it on the scene
		square.setLocation(50, 50);

		// Let's create a scaling animation for the square
		final ScaleBehavior scaleBehavior = new ScaleBehavior();
		scaleBehavior.setValues(1d, 2d, 1d, 2d, .5, .5);

		// The animation starts at time=2000ms and last for 3000ms
		scaleBehavior.setFrameTime(2000, 3000);

		// Let's create a rotating animation for the square
		final RotateBehavior rotateBehavior = new RotateBehavior();
		rotateBehavior.setValues(0, 2 * Math.PI, .5, .5);

		// Let's add those animations to the square

		// When the scale animation finishes, we start the rotating animation
		scaleBehavior.addListener(BehaviorListener.valueOfExpired(new BehaviorExpiredListener() {
			public void onExpired(BaseBehavior behavior, double time, Actor actor) {
				rotateBehavior.setFrameTime(time, 3000);

		// When the rotating animation finishes, we start the scaling animation
		rotateBehavior.addListener(BehaviorListener.valueOfExpired(new BehaviorExpiredListener() {
			public void onExpired(BaseBehavior behavior, double time, Actor actor) {
				scaleBehavior.setFrameTime(time, 3000);


	public static void main(String[] args) {


Here is the result :

Want to use it ?

First, you must have a JDK8 installed.

If you want to use it in a Maven project, add this repository in the definition of the POM file :


And add the following dependency (change the artifact id to 'caatja-gwt' for a GWT application) :

You can’t perform that action at this time.