Skip to content

Instantly share code, notes, and snippets.

Created September 1, 2015 20:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/7206df0f55cbcb32bee9 to your computer and use it in GitHub Desktop.
Save anonymous/7206df0f55cbcb32bee9 to your computer and use it in GitHub Desktop.
import javafx.animation.Transition;
import javafx.scene.layout.Region;
import javafx.util.Duration;
public class ResizeHeightTranslation extends Transition {
protected Region region;
protected double startHeight;
protected double newHeight;
protected double heightDiff;
public ResizeHeightTranslation( Duration duration, Region region, double newHeight ) {
setCycleDuration(duration);
this.region = region;
this.newHeight = newHeight;
this.startHeight = region.getHeight();
this.heightDiff = newHeight - startHeight;
}
@Override
protected void interpolate(double fraction) {
region.setMinHeight( startHeight + ( heightDiff * fraction ) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment