Skip to content

Repository files navigation

FastAnimation 0.1.2 [ALPHA-2026-08-19] — Ultra-Fast Native Animation Engine for Java

Status License: MIT Java Platform JitPack


⚡ Ultra-fast animation and timeline orchestration for the FastJava ecosystem.

FastAnimation is a high-performance timeline engine built for zero-latency UI transitions and complex motion graphics. It is deeply integrated and bundled with FastTween—our zero-overhead interpolation engine—to provide a complete, unified toolkit for orchestrating fluid, native-speed animations in Java.

Watch the Demo | Watch the JMH Benchmark

FastAnimation Showcase


Quick Start

import fastanimation.FastAnimation;
import fastanimation.AnimationEngine.HeartbeatMode;
import fasttween.FastTween;

public class Example {
    public static void main(String[] args) {
        // Optional: Switch to High-Precision Native VSync mode
        FastAnimation.setHeartbeatMode(HeartbeatMode.NATIVE_VSYNC);

        // Orchestrate a sequence of FastTweens seamlessly
        FastAnimation.sequence(
                        FastTween.to(0, 100, 1000).onUpdate(val -> System.out.println("X: " + val)),
                        FastTween.to(1.0f, 0.0f, 500).onUpdate(val -> System.out.println("Fade: " + val))
                ).onComplete(() -> System.out.println("Animation Complete!"))
                .start();
    }
}

Table of Contents


Why FastAnimation?

Standard Java animation approaches (like javax.swing.Timer, JavaFX Timeline, or custom Thread.sleep loops) suffer from fundamental architectural flaws when pushed to the limit:

  • OS Scheduler Inaccuracies: Thread.sleep is notoriously inaccurate on Windows, causing micro-stutters and jitter.
  • Garbage Collection Pauses: Creating new objects during high-speed renders causes the GC to stall the animation thread.
  • Single-Thread Bottlenecks: Tying the animation math to the UI render thread causes the entire app to feel sluggish.

FastAnimation solves this by fundamentally rethinking timeline execution:

  • True Native Precision: Hooks directly into Windows Multimedia Timers (via FastDWM) or VSync hardware events to bypass the JVM's sleep inaccuracies entirely.
  • Zero-Allocation Architecture: The core engine processes 10,000,000+ parallel animations per tick without instantiating a single object, rendering Garbage Collection irrelevant during motion.
  • Pure Mathematical Execution: FastAnimation only handles time and progress, decoupling the heavy lifting from the UI thread.
  • Powered by FastTween: It seamlessly orchestrates FastTween instances. While FastTween handles the raw interpolation (e.g., smoothly sliding a value from 0 to 100), FastAnimation acts as the conductor, managing sequences, loops, parallel execution, and complex keyframe timelines across millions of concurrent tweens.

Features

  • ⚡ High-Precision Timing: Sub-millisecond animation updates using FastExecution scheduling engine.
  • 📈 Timeline Management: Complex keyframe sequences and concurrent track orchestration.
  • 📦 Zero GC Pressure: Reusable animation instances and optimized data structures.
  • 🖇️ Ecosystem Ready: Seamlessly integrates with FastTween for interpolation and FastExecution for scheduling.

Performance Benchmarks

FastAnimation is rigorously profiled using JMH to guarantee zero overhead. Watch the JMH Benchmark

Metric / Orchestration Type Score (ops/ms) Ops per Second
Parallel Tracks ~14,901 ops/ms > 14.9 Million
Sequence Tracks ~96,739 ops/ms > 96.7 Million

Measured on Windows 11, Intel Core i5-1135G7 (Surface Pro 8), JDK 21.0.12. The engine now uses FastExecution for high-precision scheduling via FastDWM to guarantee zero-jitter native heartbeats even under GC pressure.


API Quick Reference

Method Description
setHeartbeatMode(mode) Sets the underlying engine ticker (e.g. HeartbeatMode.NATIVE_VSYNC).
sequence(tweens...) Orchestrates a sequence where tweens play one after the other.
parallel(tweens...) Orchestrates a group of tweens that play simultaneously.
timeline(keyframes...) Orchestrates tweens based on specific percentage-based keyframes in a timeline.

Technical Examples & Hero Demos

Case Java Example Launcher Description
Pseudo-3D Particle Realm Demo.java run-demo.bat 3D-to-2D projection with 300 independently tweened objects.
Spheres + Swarm Particles ParticleTimelineDemo.java run-demo-particles.bat 300 FastTween spheres + 50,000 harmonic particles.
Pure Particle Cloud (50k) PureParticleCloudDemo.java run-demo-cloud.bat 50,000 pure white 3D particles radiating from the core.

Installation

Option 1: Maven (Recommended)

Add the JitPack repository and the dependency to your pom.xml:

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>fastanimation</artifactId>
        <version>0.1.1</version>
    </dependency>
    <!-- Recommended for interpolation -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>fasttween</artifactId>
        <version>0.1.0</version>
    </dependency>
    <!-- Required for high-precision scheduling -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>fastexecution</artifactId>
        <version>0.1.0</version>
    </dependency>
    <!-- Required for NATIVE_MM and NATIVE_VSYNC -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>fastdwm</artifactId>
        <version>0.1.0</version>
    </dependency>
    <!-- Optional: High-throughput GPU Compute Shader & Math Pipeline -->
    <dependency>
        <groupId>com.github.andrestubbe</groupId>
        <artifactId>fastgpu</artifactId>
        <version>0.1.0</version>
        <optional>true</optional>
    </dependency>
</dependencies>

Note on FastGPU Integration: FastGPU is completely optional. For high-density particle simulations and hardware compute workloads (see ParticleTimelineDemo), FastGPU can be paired with FastAnimation to offload parallel 3D matrix math, depth buffering, and color shaders directly to GPU compute pipelines while FastAnimation handles timeline orchestration.

Option 2: Gradle (via JitPack)

repositories {
    maven { url 'https://jitpack.io' }
}

dependencies {
    implementation 'com.github.andrestubbe:fastanimation:0.1.1'
    // Recommended for interpolation
    implementation 'com.github.andrestubbe:fasttween:0.1.0'
    // Required for high-precision scheduling
    implementation 'com.github.andrestubbe:fastexecution:0.1.0'
    // Required for NATIVE_MM and NATIVE_VSYNC
    implementation 'com.github.andrestubbe:fastdwm:0.1.0'
    implementation 'com.github.andrestubbe:fastcore:v1.0.0'
    // Optional: High-throughput GPU Compute
    compileOnly 'com.github.andrestubbe:fastgpu:0.1.0'
}

Option 3: Direct Download (No Build Tool)

Download the latest JAR directly to add it to your classpath:

  1. 📦 fastanimation-0.1.1.jar (The Core Library)
  2. 📦 fasttween-0.1.0.jar (Recommended for interpolation)
  3. 📦 fastexecution-0.1.0.jar (Required for high-precision scheduling)
  4. 📦 fastdwm-0.1.0.jar (Required for NATIVE_MM and NATIVE_VSYNC)
  5. 📦 fastcore-0.1.0.jar (Required Native JNI loader)
  6. 📦 fastgpu-0.1.0.jar (Optional: GPU Compute Engine)

Documentation

  • COMPILE.md: Full compilation guide (Maven Build Setup).
  • REFERENCE.md: Exhaustive catalog of timeline strategies and engine architecture.
  • PHILOSOPHY.md: Zero-allocation and low-overhead processing designs.
  • ROADMAP.md: Planned milestone features and performance extensions.
  • CHANGELOG.md: Planned milestone features and performance extensions.

Platform Support

Platform Status
Windows 10/11 ✅ Fully Supported
Linux 🚧 Planned
macOS 🚧 Planned

License

MIT License — See LICENSE for details.


Related Projects

  • FastTween — Zero overhead pool-based tweening
  • FastAnimation — Zero overhead timeline orchestration
  • FastGPU — High-throughput parallel GPU compute and math engine
  • FastExecution — High-precision scheduling engine
  • FastDWM — Native Desktop Window Manager API
  • FastCore — Native JNI Loader and Utilities
  • FastTheme — High-performance native window styling

Part of the FastJava EcosystemMaking the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋

About

🎞️ Ultra‑fast native animation engine for Java — zero‑allocation timeline orchestration with native VSync/MM timers, millions of parallel tweens per tick, and seamless integration with FastTween for fluid, jitter‑free motion.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages