AnimateFX

repository·master·Indexed 19 days ago

https://github.com/typhon0/animatefx

A library of ready-to-use animations for JavaFX, providing custom animations, interpolators, and sequencing capabilities. It supports Java 11, 17, 21, and 25+ LTS, and is safe for use in headless environments. Features include animation chaining via playOnFinished() and lazy configuration using builder-style setters.

Tokens
1.1K
Snippets
6
Records
7
Agent score
18%

What's inside AnimateFX

  1. Compatibility and Environment Support

    master

    AnimateFX is designed for modern Java/JavaFX environments:

    • Java Compatibility: Compiled targeting Java 11 (LTS). It is fully backward compatible and supports Java 11, 17, 21, and 25+ LTS.
    • Build Systems: Built using Gradle 8.7.
    • Headless Environments: Safe for use in headless or JRE-only runtimes (like Docker containers) that lack a native display interface.
  2. Install AnimateFX Snapshots

    master

    If you need to use the latest snapshot builds, you must add the Sonatype snapshot repository to your build configuration before declaring the dependency.

    ### Gradle
    ```groovy
    repositories {
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    }
    
    dependencies {
        implementation 'io.github.typhon0:AnimateFX:1.3.1-SNAPSHOT'
    }

    Maven

    <repositories>
        <repository>
            <id>snapshots</id>
            <name>libs-snapshot</name>
            <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
        </repository>
    </repositories>
    
    <dependencies>
        <dependency>
            <groupId>io.github.typhon0</groupId>
            <artifactId>AnimateFX</artifactId>
            <version>1.3.1-SNAPSHOT</version>
        </dependency>
    </dependencies>
  3. Install AnimateFX via Maven

    master

    To use AnimateFX in a Maven project, add the following dependency to your pom.xml.

    <dependency>
      <groupId>io.github.typhon0</groupId>
      <artifactId>AnimateFX</artifactId>
      <version>1.3.1</version>
    </dependency>
  4. Install AnimateFX via Gradle

    master

    To use AnimateFX in a Gradle project (versions 7.x or 8.x), add the dependency to your dependencies block. Ensure you have the java and java-library plugins applied.

    plugins {
        id 'java'
        id 'java-library'
    }
    
    dependencies {
        implementation 'io.github.typhon0:AnimateFX:1.3.1'
    }
  5. Chain animations using playOnFinished()

    master

    You can sequence animations so that one starts immediately after another finishes using the .playOnFinished(Animation nextAnimation) method.

    Safety Note: Chained animations are manual-stop safe. If you call .stop() on the parent animation, the entire chain will halt and the subsequent animation will not launch.

    Text text = new Text("AnimateFX");
    
    // When Bounce finishes naturally, BounceIn will play
    new Bounce(text).playOnFinished(new BounceIn(text)).play();
  6. Configure animations lazily with Builders

    master

    Animations like GlowBackground or GlowText can be instantiated with parameterless constructors and configured using builder-style setters. This allows you to define the animation properties before binding it to a specific Node later in the UI lifecycle using .setNode(Node node).

    GlowBackground glow = new GlowBackground(myRegion.getBackground())
        .setColorA(Color.WHITE)
        .setColorB(Color.YELLOW)
        .setColorSteps(20);
    
    // Set the node later in the UI lifecycle
    glow.setNode(myRegion);
    glow.play();