IAmGio Animated Versions Save

:ocean: Modern animation library for JavaFX.

v1.3.0

6 months ago
  • Added AnimatedSlider, a Slider implementation that dynamically animates its value.
  • Added animation callbacks (#6)

Callbacks

Animation callbacks were added to:

  • AnimationProperty
  • Presets
  • AnimatedValue, including AnimatedValueLabel
  • Animation

transition

The callback for Animation (used for AnimateFX-based features, such as switchers and animated containers) is extremely simple:

Animation animation = new Animation(new FadeIn());
animation.setOnFinished(e -> ...);

For the sake of usability, a fluent setter was also added:

Animation animation = new Animation(new FadeIn()).onFinished(e -> ...);

binding

The implementation for the binding package is slightly different: the classes listed previously now feature setOnAnimationStarted and setOnAnimationEnded.

AnimationProperty<Double> property = AnimationProperty.of(someProperty());
property.setOnAnimationStarted(e -> ...);
property.setOnAnimationEnded(e -> ...);

They handle AnimationEvents that can be affected by interruptions.

From the AnimationEvent#isInterrupted() documentation:

  • If this event represents the end of an animation, the interrupted status means the animation stopped before the expected time because the wrapped value was externally changed and a new animation has to be played.
  • If this event represents the start of an animation, the interrupted status means the animation started right after an interrupted end animation.
property.setOnAnimationEnded(e -> {
    if (e.isInterrupted()) {
        System.out.println("The animation was interrupted, a new one will play now");
    }
})

A fluent setter is available here too:

Animated animated = new Animated(node,
    new AnimatedOpacity()
        .onAnimationEnded(e -> ...)
)
AnimationProperty.of(someProperty()).onAnimationStarted(e -> ...).register();
AnimatedValueLabel<Double> label = new AnimatedValueLabel<>(0.0)
    .onAnimationStarted(e -> ...)
    .onAnimationEnded(e -> ...);

v1.2.0

8 months ago

Changelog

  • Added clip animations that create negative space around a node: CircleClipIn, CircleClipOut, RectangleClipIn, RectangleClipOut. They can be used the same way other AnimateFX animations are used;
  • Fixed a visual bug that would produce blurry images with an AnimatedThemeSwitcher on high-DPI screens;
  • Animation can no longer wrap null animations. Animation.none() now returns an instance of None;
  • Animation's delay property can now be set via FXML;
  • AnimatedSwitcher#of now throws an IllegalStateException instead of IllegalAccessError if a child is already set;
  • Curve was moved to the common package.

Circle clip theme switch

CircleClipOut used with an AnimatedThemeSwitcher

v1.1.0

10 months ago

Changelog

  • Added AnimatedValueLabel to display some content which is implicitly animated every time its value changes: see the README for further information (example code);
  • Added AnimationProperty#addBinding to bind a property to an animated one;
  • Added IntegerPropertyWrapper to allow animated bindings for int values;
  • Added elastic animation curves: EASE_IN_ELASTIC, EASE_OUT_ELASTIC, EASE_IN_OUT_ELASTIC;
  • AnimatedThemeSwitcher#init now throws an IllegalStateException if it had already been initialized (related to #4);
  • Removed the generic type from the CustomizableAnimation#custom method signature;
  • Moved the Pausable interface to the new common package.

v1.0.1

10 months ago

It is now possible to register on-demand properties, without an Animated node, as long as a target node is set:

new AnimatedPrefSize(node).register();

v1.0.0

10 months ago

animated is getting a new major release!

Common changelog

  • The package layout has been changed for the sake of clarity. The library is now split in two independent parts: binding (implicit animations that react to changes), and transition (features that rely on AnimateFX animations).
  • Added full FXML support: see the README for more information.

binding changelog

The implicit binding API has been redesigned to provide a more concise way to create implicit animations:

  • Animated now accepts multiple properties at once that can also be edited later via getTargetProperties(). AnimatedMulti was removed.

  • Animated is no longer generic.

  • Pre-made animated nodes (such as AnimatedOpacity) are now properties called presets. This lets you mix standard properties and presets within the same Animated node with ease.
    Presets also have a new zero-arguments constructor that lets the property inherit the target node from its Animated parent.

    Animated animated = new Animated(child, new AnimatedOpacity());
    
  • Animated now requires animation properties instead of property wrappers. You can use AnimationProperty.of to wrap a JavaFX property instead of PropertyWrapper.of.

    Animated animated = new Animated(child, AnimationProperty.of(child.opacityProperty()));
    
  • AnimatedSize was renamed to AnimatedPrefSize.

  • AnimatedPosition was renamed to AnimatedTranslatePosition.

  • AnimatedDropShadow was split into two different properties: AnimatedDropShadow.Color and AnimatedDropShadow.Radius.

  • Removed isActive() and setActive(active) from Animated and AnimationProperty. They now implement the Pausable interface, with isPaused(), pause(), resume().

  • Removed the deprecated PropertyWrapper#createParallelProperty method.

transition changelog

  • AnimateFX-based features now have empty constructors that use FadeIn and FadeOut as default entrance and exit animations, which can now be updated after instantiation via setIn and setOut. animationInProperty() and animationOutProperty() were also added. These classes include:

    • AnimatedContainer subclasses: AnimatedHBox and AnimatedVBox;
    • AnimatedSwitcher;
    • AnimatedLabel.
  • AnimatedThemeSwitcher is now instantiated via a constructor, and the static init method was removed.
    A non-static init() method must be called after instantiation in order to register the hook.

    AnimatedThemeSwitcher themeSwitcher = new AnimatedThemeSwitcher(scene, new FadeOut());
    themeSwitcher.init();
    
  • AnimatedThemeSwitcher's previous getAnimation was replaced with getOut. setOut is also available.

  • Fixed AnimatedLabel not pausing correctly.

  • Added AnimatedSwitcher#childProperty.

  • Added AnimatedLabel#currentLabelProperty and AnimatedLabel#labelFactoryProperty.

Migration guide

If you are upgrading the library from a 0.x.x version, you will most likely have a bunch of errors to fix before having a successful compilation. Here are some useful fixes:

  • The package layout has been changed: let your IDE find out the new location of the imported classes.

  • Use AnimationProperty.of instead of PropertyWrapper.of. Also, Animated is no longer generic, so you can remove the diamonds.

  • Use AnimationProperty#register instead of PropertyWrapper#registerAnimation for independent animations.

  • Use presets instead of pre-made animated nodes:

    // Before
    AnimatedOpacity animated = new AnimatedOpacity(node);
    
    // After
    Animated animated = new Animated(node, new AnimatedOpacity());
    
  • Use Animated instead of AnimatedMulti:

    // Before
    AnimatedMulti animated = new AnimatedMulti(node,
        PropertyWrapper.of(node.prefWidthProperty()),
        PropertyWrapper.of(node.prefHeightProperty()
    );
    
    // After
    Animated animated = new Animated(node,
        AnimationProperty.of(node.prefWidthProperty()),
        AnimationProperty.of(node.prefHeightProperty())
    );
    
    // Or even better
    Animated animated = new Animated(node, new AnimatedPrefSize());
    
  • Instantiate AnimatedThemeSwitcher via constructor instead of the static init method:

    // Before
    AnimatedThemeSwitcher themeSwitcher = AnimatedThemeSwitcher.init(scene);
    
    // After
    AnimatedThemeSwitcher themeSwitcher = new AnimatedThemeSwitcher(scene, new FadeOut());
    themeSwitcher.init();
    
  • Use AnimatedThemeSwitcher#get/setOut instead of get/setAnimation.

v0.7.0

1 year ago
  • Animated containers are more optimized;
  • Stricter rules have been applied to constructors (AnimatedSwitcher, AnimatedContainer, AnimatedThemeSwitcher, ...) regarding null animations, that aren't accepted now;
  • Added the Animation.none() method (equivalent to new Animation(null) to represent a non-animation;
  • Implemented PropertyWrapper#registerAnimation as a preferred alternative to new AnimationProperty(propertyWrapper).register().

v0.6.1

1 year ago
  • AnimationProperty was moved out of the internal package as a valid, flexible alternative to Animated;
  • PropertyWrapper.of and the Kotlin extension function Property#animated now feature different overloads for each supported wrapper type in order to minimize ambiguity;
  • Added Automatic-Module-Name (#2);
  • Fixed some missing Javadocs due to syntax errors.

v0.6.0

1 year ago
  • AnimatedThemeSwitcher is now completely implicit: it now directly affects the scene's stylesheets and does not need to be carried around;
  • Implemented AnimatedLabel to animate text changes;
  • Fixed a relocation issue with AnimatedHBox;
  • Added 9 more curves (expo, back and bounce for ease in/out/in-out) and add Curve#getCurveFunction;
  • Some classes that are intended to be used internally have been moved to the internal sub-package.

v0.5.1

1 year ago
  • Implemented AnimatedLayout for animated repositioning when resizing a root node (example);
  • Implemented isActive and setActive for Animated and AnimatedMulti.

v0.5.0

2 years ago

Fixed animations getting stuck if a bound property was updated by the user while an animation was playing.
PropertyWrapper#createParallelProperty is now deprecated.