Created
September 1, 2015 20:51
-
-
Save anonymous/7206df0f55cbcb32bee9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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