All Projects → iAmGio → animated

iAmGio / animated

Licence: MIT license
🌊 Implicit animations for JavaFX.

Programming Languages

java
68154 projects - #9 most used programming language
CSS
56736 projects
kotlin
9241 projects

Projects that are alternatives of or similar to animated

Sunset.css
This library offers a collection of different CSS-powered transitions.
Stars: ✭ 99 (+25.32%)
Mutual labels:  transition, animations, transitions
Easytransform
Enhancing CSS transform with a little bit of JavaScript.
Stars: ✭ 10 (-87.34%)
Mutual labels:  transition, animations, transitions
Hamburger React
Animated hamburger menu icons for React (1.5 KB) 🍔
Stars: ✭ 391 (+394.94%)
Mutual labels:  transition, animations, transitions
lib-preferences
Lib-Preferences is a library for easy storing simple data to a Preferences.properties file in a Java(FX) & Maven desktop application.
Stars: ✭ 12 (-84.81%)
Mutual labels:  javafx, javafx-library
CustomSegueDemo
Demonstrates encapsulation of a custom view controller transition into a UIStoryboardSegue subclass
Stars: ✭ 31 (-60.76%)
Mutual labels:  animations, transitions
Transition
Easy interactive interruptible custom ViewController transitions
Stars: ✭ 2,566 (+3148.1%)
Mutual labels:  transition, transitions
medusa
A JavaFX library for Gauges
Stars: ✭ 605 (+665.82%)
Mutual labels:  javafx, javafx-library
JasperViewerFX
The JasperViewerFX is a free JavaFX library which aims to avoid use of JasperReport's swing viewer
Stars: ✭ 27 (-65.82%)
Mutual labels:  javafx, javafx-library
Grid
A grid component for javafx
Stars: ✭ 23 (-70.89%)
Mutual labels:  javafx, javafx-library
aholachek.github.io
My website
Stars: ✭ 53 (-32.91%)
Mutual labels:  animations, transitions
MaskedTextField
MaskedTextField is an component similar to JFormmatedText field and can be used in same way.
Stars: ✭ 21 (-73.42%)
Mutual labels:  javafx, javafx-library
Material-Design-Android
My stash for all things material, animations, typography, iconography, transitions, Animated VD, Color Palette API, UI design, and more.
Stars: ✭ 38 (-51.9%)
Mutual labels:  animations, transitions
Cpcollectionviewkit
Interesting UICollectionView layouts and transitions
Stars: ✭ 140 (+77.22%)
Mutual labels:  transition, animations
Stfalconimageviewer
A simple and customizable Android full-screen image viewer with shared image transition support, "pinch to zoom" and "swipe to dismiss" gestures
Stars: ✭ 1,734 (+2094.94%)
Mutual labels:  transition, transitions
Editly
Slick, declarative command line video editing & API
Stars: ✭ 3,162 (+3902.53%)
Mutual labels:  transition, animations
Easytransitions
A simple way to create custom interactive UIViewController transitions
Stars: ✭ 1,592 (+1915.19%)
Mutual labels:  transition, animations
FluxFX
Flux architecture with JavaFX
Stars: ✭ 24 (-69.62%)
Mutual labels:  javafx, javafx-library
advanced-bindings
Collection of Binding helpers for JavaFX(8)
Stars: ✭ 63 (-20.25%)
Mutual labels:  javafx, javafx-library
Simpletab
A Simple iOS Tab Bar Controller with animation support.
Stars: ✭ 83 (+5.06%)
Mutual labels:  transition, animations
Css Animations Pocket Guide
A pocket guide to get started writing CSS Animations. ✨
Stars: ✭ 94 (+18.99%)
Mutual labels:  transition, animations

animated

animated introduces implicit animations, a completely new concept in JavaFX strongly inspired by Flutter's animations and motion widgets.

Index

  1. Getting started
  2. Implicit animations
  3. Animated containers
  4. Animated switchers
  5. Animated theme switch
  6. Other examples
  7. Kotlin extensions

Getting started

Maven:

<dependency>
    <groupId>eu.iamgio</groupId>
    <artifactId>animated</artifactId>
    <version>0.5.1</version>
</dependency>

Gradle:

allprojects {
    repositories {
        mavenCentral()
    }
}
dependencies {
    implementation 'eu.iamgio:animated:0.5.1'
}



Implicit animations

Forget about timelines, explicit animations and other stuff that pollutes your code. This animation system will provide versatility to your code and interface.

Demo
Code

Animated<Double> animated = new Animated<>(child, PropertyWrapper.of(child.opacityProperty()));
root.getChildren().add(animated);

// Later...
child.setOpacity(0.5); // Plays the transition

This approach instantiates an Animated node that contains one child and is bound to a property.
Now that we have set an animated bound, we'll see that child.setOpacity(someValue) creates a transition between the initial and final value.

PropertyWrapper.of automatically finds out the best kind of wrapper for a given property.
Currently supported wrappers are DoublePropertyWrapper and ObjectPropertyWrapper<T>.

There are some pre-made animated nodes that take the child as an argument as well (list will expand):

  • AnimatedBlur
  • AnimatedDropShadow
  • AnimatedColor (shapes only)
  • AnimatedOpacity
  • AnimatedPosition
  • AnimatedRotation
  • AnimatedSize
  • AnimatedScale
  • AnimatedLayout

Multiple animations at once

In case you need to animate more than one property of a single node, AnimatedMulti comes to the rescue. At this time it only takes properties as arguments, so it won't be possible to use pre-made nodes (list above).

AnimatedMulti animated = new AnimatedMulti(child,
    PropertyWrapper.of(child.opacityProperty()),
    PropertyWrapper.of(child.prefWidthProperty()),
    PropertyWrapper.of(child.prefHeightProperty())
);
root.getChildren().add(animated);

// Later...
child.setOpacity(0.5);   // Plays the transition
child.setPrefWidth(100); // Plays the transition
child.setPrefHeight(50); // Plays the transition

Custom animations

The default animation is linear and lasts 1 second. It can be customized by calling either withSettings(AnimationSettings settings) or custom(Function<AnimationSettings, AnimationSettings> settings), both methods available on property wrappers and animated nodes.

Examples:

AnimatedOpacity animated = new AnimatedOpacity(child)
    .custom(settings -> settings.withDuration(Duration.seconds(.5)).withCurve(Curve.EASE_IN_OUT));
AnimatedMulti animated = new AnimatedMulti(child,
    PropertyWrapper.of(child.opacityProperty())
        .custom(settings -> settings.withDuration(Duration.seconds(.8))),
    PropertyWrapper.of(child.rotateProperty())
        .custom(settings -> settings.withDuration(Duration.seconds(.5)),
).custom(settings -> settings.withCurve(Curve.EASE_OUT)); // 'custom' applies only these settings to the properties.
                                                          // 'withSettings' overrides all instead.
root.getChildren().add(animated);



Animated containers

animated provides custom implementations of VBox and HBox that animate their content whenever their children are affected by a change.
This feature is based on animations from AnimateFX.

Demo
Code

Constructors:

  • Animation in, Animation out wraps two AnimateFX objects into customizable animated objects;
  • AnimationFX in, AnimationFX out takes two raw AnimateFX animations that cannot be customized;
  • AnimationPair animation takes a pair of animations, mostly used with pre-made pairs (e.g. AnimationPair.fade()).

pause() and resume() allow disabling/enabling animations so that you can switch back to the regular implementation and forth.

Example:

AnimatedVBox vBox = new AnimatedVBox(AnimationPair.fade());

// Later...
vBox.getChildren().add(someNode);    // someNode fades in
vBox.getChildren().remove(someNode); // someNode fades out



Animated switchers

The library also provides an AnimatedSwitcher node that creates a transition whenever its child changes.
As for animated containers, this feature relies on AnimateFX.

Demo
Code

See animated containers for information about constructors.
Right after the instantiation, calling of(Node child) will set the initial child without any animation played.

Example:

AnimatedSwitcher switcher = new AnimatedSwitcher(
    new Animation(new FadeInDown()).setSpeed(2), 
    new Animation(new FadeOutDown()).setSpeed(1.5)
).of(firstChild);
root.getChildren().add(switcher);

// Later...
switcher.setChild(secondChild); // Plays the transition



Animated theme switch

It is possible to create a transition whenever the stylesheets of the scene change via AnimatedThemeSwitcher, based on AnimateFX.

Theme
Code

AnimatedThemeSwitcher themeSwitcher = AnimatedThemeSwitcher.of(scene);
themeSwitcher.setTheme("/light.css");         // Initial theme
theme.setAnimation(new Animation(/* ... */)); // Optional: defaults to FadeOut

// Later...
themeSwitcher.animateTheme("/dark.css"); // Plays the transition

Note that not every type of root can be animated properly, such as VBox and HBox. Parents that allow overlapping children, i.e. Pane, are suggested.




Other examples

Button
Button color and border

Shadow
Drop shadows + switcher

Root switch
Root switch

Layout alignment
Layout alignment (inspired by the Edge home page)




Kotlin extensions

Extension functions make the library less verbose with Kotlin.
Example:

val animated: Animated = Animated(child, child.someProperty().animated())
val pair: AnimationPair = FadeIn().options(speed = 1.5) outTo FadeOut()
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].