⚡ 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 GPU Demo (YouTube) | Watch Simple Demo | Watch the JMH Benchmark
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();
}
}- Why FastAnimation?
- Quick Start
- Features
- Performance Benchmarks
- API Quick Reference
- Installation
- Documentation
- Platform Support
- License
- Related Projects
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.sleepis 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.
- ⚡ 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.
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.
| 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. |
| Case | Java Example | Launcher | Description |
|---|---|---|---|
| Vulkan Compute Particle Swarm (100k) | ParticleGPUDemo.java | run-particles-GPU-demo.bat |
300 FastTween spheres + 100,000 particles (Vulkan GLSL Compute Kernel for physics & 3D matrices). |
| Pure CPU Software Particle Swarm (50k) | ParticleCPUDemo.java | run-particles-CPU-demo.bat |
300 FastTween spheres + 50,000 harmonic particles (Pure CPU Software Rasterizer). |
| Pseudo-3D Particle Realm | Demo.java | run-demo.bat |
3D-to-2D projection with 300 independently tweened objects. |
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>
<!-- Required Native JNI loader -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastcore</artifactId>
<version>0.1.0</version>
</dependency>
<!-- Optional: High-throughput GPU Compute Shader & Math Pipeline (Vulkan SPIR-V) -->
<dependency>
<groupId>com.github.andrestubbe</groupId>
<artifactId>fastgpu</artifactId>
<version>0.1.0</version>
<optional>true</optional>
</dependency>
</dependencies>Note on FastGPU Integration:
FastGPUis completely optional. It is used to offload massive parallel physics, boid separation, organic turbulence vectors, and 3D matrix math directly to hardware via Vulkan Compute Shaders (GLSL to SPIR-V) whileFastAnimationandFastTweenorchestrate the timeline. WithoutFastGPU,FastAnimationruns identically on pure CPU.
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'
// Required Native JNI loader
implementation 'com.github.andrestubbe:fastcore:0.1.0'
// Optional: High-throughput GPU Compute (Vulkan GLSL Compute)
compileOnly 'com.github.andrestubbe:fastgpu:0.1.0'
}Download the latest JAR directly to add it to your classpath:
- 📦 fastanimation-0.1.1.jar (The Core Library)
- 📦 fasttween-0.1.0.jar (Recommended for interpolation)
- 📦 fastexecution-0.1.0.jar (Required for high-precision scheduling)
- 📦 fastdwm-0.1.0.jar (Required for NATIVE_MM and NATIVE_VSYNC)
- 📦 fastcore-0.1.0.jar (Required Native JNI loader)
- 📦 fastgpu-0.1.0.jar (Optional: GPU Compute Engine)
- 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 | Status |
|---|---|
| Windows 10/11 | ✅ Fully Supported |
| Linux | 🚧 Planned |
| macOS | 🚧 Planned |
MIT License — See LICENSE for details.
- 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 Ecosystem — Making the JVM faster. Small package. Maximum speed. Zero bloat. 🚀📋
