本文整理匯總了Java中javafx.animation.FadeTransition.setInterpolator方法的典型用法代碼示例。如果您正苦於以下問題:Java FadeTransition.setInterpolator方法的具體用法?Java FadeTransition.setInterpolator怎麽用?Java FadeTransition.setInterpolator使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.FadeTransition
的用法示例。
在下文中一共展示了FadeTransition.setInterpolator方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initGraphics
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void initGraphics() {
font = Font.font(0.4 * PREFERRED_HEIGHT);
text = new Text(getSkinnable().getText());
text.setFont(font);
text.setFill(getSkinnable().getTextColor());
thumb = new Rectangle();
thumb.setFill(getSkinnable().getThumbColor());
thumb.setOpacity(0.0);
thumb.setMouseTransparent(true);
pressed = new FadeTransition(Duration.millis(100), thumb);
pressed.setInterpolator(Interpolator.EASE_IN);
pressed.setFromValue(0.0);
pressed.setToValue(0.8);
released = new FadeTransition(Duration.millis(250), thumb);
released.setInterpolator(Interpolator.EASE_OUT);
released.setFromValue(0.8);
released.setToValue(0.0);
pane = new Pane(thumb, text);
getChildren().setAll(pane);
}
示例2: animate
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void animate(Circle particle, Path path) {
Random randGen = new Random();
PathTransition pathTransition = new PathTransition(Duration.seconds(path.getElements().size() * (randGen.nextInt(30) + 30)), path, particle);
pathTransition.setInterpolator(Interpolator.EASE_OUT);
ScaleTransition scaleTransition = new ScaleTransition(Duration.seconds(3f), particle);
scaleTransition.setToX(10f);
scaleTransition.setToY(10f);
scaleTransition.setInterpolator(Interpolator.EASE_OUT);
FadeTransition fadeTransition = new FadeTransition(Duration.seconds(6f), particle);
fadeTransition.setToValue(0.7);
fadeTransition.setInterpolator(Interpolator.EASE_OUT);
pathTransition.play();
scaleTransition.play();
fadeTransition.play();
}
示例3: AnimatedPopup
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private AnimatedPopup() {
showFadeTransition = new FadeTransition(Duration.seconds(0.2), getScene().getRoot());
showFadeTransition.setFromValue(0);
showFadeTransition.setToValue(1);
showFadeTransition.setInterpolator(new BackInterpolator());
showScaleTransition = new ScaleTransition(Duration.seconds(0.2), getScene().getRoot());
showScaleTransition.setFromX(0.8);
showScaleTransition.setFromY(0.8);
showScaleTransition.setToY(1);
showScaleTransition.setToX(1);
showScaleTransition.setInterpolator(new BackInterpolator());
hideFadeTransition = new FadeTransition(Duration.seconds(.3), getScene().getRoot());
hideFadeTransition.setFromValue(1);
hideFadeTransition.setToValue(0);
hideFadeTransition.setInterpolator(new BackInterpolator());
hideScaleTransition = new ScaleTransition(Duration.seconds(.3), getScene().getRoot());
hideScaleTransition.setFromX(1);
hideScaleTransition.setFromY(1);
hideScaleTransition.setToY(0.8);
hideScaleTransition.setToX(0.8);
hideScaleTransition.setInterpolator(new BackInterpolator());
hideScaleTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
if (AnimatedPopup.super.isShowing()) {
AnimatedPopup.super.hide();
}
}
});
}
示例4: Led
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public Led() {
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(
"LedView.fxml"));
fxmlLoader.setRoot(this);
fxmlLoader.setController(this);
try {
fxmlLoader.load();
} catch (IOException exception) {
throw new RuntimeException(exception);
}
//==============================================//
//========== PERSISTANT CIRCLE INIT ============//
//==============================================//
persistentCircle.setFill(Color.TRANSPARENT);
persistentCircle.setStroke(Color.RED);
persistentCircle.setStrokeWidth(2);
//==============================================//
//============= FADING CIRCLE INIT =============//
//==============================================//
flashingCircle.setOpacity(0.0);
fade = new FadeTransition(Duration.seconds(0.5), flashingCircle);
fade.setInterpolator(Interpolator.EASE_OUT);
fade.setFromValue(1.0);
fade.setToValue(0);
//fade.setAutoReverse(true);
fade.setCycleCount(1);
}
示例5: fade
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public static void fade(Node node, boolean in) {
FadeTransition ft = new FadeTransition(Duration.millis(200), node);
ft.setFromValue(node.getOpacity());
ft.setToValue(in ? 1 : 0);
ft.setInterpolator(Interpolator.EASE_OUT);
ft.play();
}
示例6: showOrHide
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
* Shows or hides the pane with an animation.
*
* @param stackPane The StackPane, which is shown or hidden.
* @param show True, when shown, false when hidden.
*/
private void showOrHide(final AnimatedStackPane stackPane, final boolean show) {
stackPane.setVisible(true);
ongoingTransitions++;
TranslateTransition translateTransition = new TranslateTransition(Duration.seconds(.5), stackPane);
FadeTransition fadeTransition = new FadeTransition(Duration.seconds(.5), stackPane);
stackPane.setCache(true);
stackPane.setCacheHint(CacheHint.SPEED);
contentPane.setClip(new Rectangle(stackPane.getBoundsInLocal().getWidth(), stackPane.getBoundsInLocal().getHeight()));
if (show) {
translateTransition.setFromY(-stackPane.getBoundsInLocal().getHeight());
translateTransition.setToY(0);
fadeTransition.setToValue(1);
fadeTransition.setFromValue(0);
translateTransition.setInterpolator(new CircularInterpolator(EasingMode.EASE_OUT));
fadeTransition.setInterpolator(new CircularInterpolator(EasingMode.EASE_OUT));
} else {
translateTransition.setToY(-stackPane.getBoundsInLocal().getHeight());
translateTransition.setFromY(0);
fadeTransition.setToValue(0);
fadeTransition.setFromValue(1);
translateTransition.setInterpolator(new CircularInterpolator(EasingMode.EASE_OUT));
fadeTransition.setInterpolator(new CircularInterpolator(EasingMode.EASE_OUT));
}
ParallelTransition parallelTransition = new ParallelTransition();
parallelTransition.getChildren().add(translateTransition);
parallelTransition.getChildren().add(fadeTransition);
parallelTransition.playFromStart();
parallelTransition.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent actionEvent) {
if (!show) {
titleButton.requestFocus();
stackPane.setVisible(false);
}
stackPane.setCache(false);
ongoingTransitions--;
}
});
}
示例7: initialize
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
@FXML
public void initialize() {
alert.setGraphic(IconBuilder.create(FontAwesome.FA_VOLUME_UP, 72.0).fill(Color.WHITE).shine(Color.RED).build());
if (appexitbutton) {
exitbutton.setVisible(true);
exitbutton.setGraphic(IconBuilder.create(FontAwesome.FA_POWER_OFF, 18.0).styleClass("icon-fill").build());
exitbutton.setOnAction(ev -> {
rootpane.getScene().getWindow().hide();
});
} else {
exitbutton.setVisible(false);
headerbox.getChildren().remove(exitbutton);
exitbutton = null;
}
menubutton.setGraphic(IconBuilder.create(FontAwesome.FA_NAVICON, 18.0).styleClass("icon-fill").build());
menubutton.setDisable(true);
if (appclock) {
clock = new Clock(currenttime, resources.getString("clock.pattern"));
clock.play();
}
listpagesgray.setBackground(new Background(new BackgroundFill(Color.gray(0.5, 0.75), CornerRadii.EMPTY, Insets.EMPTY)));
FadeTransition ft = new FadeTransition(Duration.millis(300), scrollpages);
ft.setFromValue(0.0);
ft.setToValue(1.0);
ft.setInterpolator(Interpolator.LINEAR);
FadeTransition ft2 = new FadeTransition(Duration.millis(300), listpagesgray);
ft2.setFromValue(0.0);
ft2.setToValue(1.0);
ft2.setInterpolator(Interpolator.LINEAR);
TranslateTransition tt = new TranslateTransition(Duration.millis(300), scrollpages);
tt.setFromX(-scrollpages.prefWidth(0));
tt.setToX(0.0);
tt.setInterpolator(Interpolator.EASE_BOTH);
TranslateTransition tt2 = new TranslateTransition(Duration.millis(300), appcontainer);
tt2.setFromX(0.0);
tt2.setToX(scrollpages.prefWidth(0));
tt2.setInterpolator(Interpolator.EASE_BOTH);
listpagestransition = new ParallelTransition(ft, ft2, tt, tt2);
listpagestransition.setRate(-1.0);
listpagestransition.setOnFinished((ActionEvent actionEvent) -> {
if (listpagestransition.getCurrentTime().equals(Duration.ZERO)) {
scrollpages.setVisible(false);
listpagesgray.setVisible(false);
}
});
}
示例8: gotoPage
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void gotoPage(String status) {
StackPane messagesroot = MessageUtils.getRoot(rootpane);
if (messagesroot != null) {
// If it is not already added to the scene, there is no need to dispose dialogs.
MessageUtils.disposeAllDialogs(messagesroot);
}
UnitPage unitpage = unitpages.get(status);
if (unitpage == null) {
unitpage = unitpages.get("notfound");
}
// clean everything
container.getChildren().clear();
FadeTransition s2 = new FadeTransition(Duration.millis(200), container);
s2.setInterpolator(Interpolator.EASE_IN);
s2.setFromValue(0.3);
s2.setToValue(1.0);
s2.playFromStart();
// Initialize grid
container.setMaxSize(unitpage.getMaxWidth(), unitpage.getMaxHeight());
for (UnitLine line : unitpage.getUnitLines()) {
container.getChildren().add(line.getNode());
}
headertitle.setText(unitpage.getText());
// Set label if empty
if (container.getChildren().isEmpty()) {
container.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
Label l = new Label();
l.setText(unitpage.getEmptyLabel());
l.setAlignment(Pos.CENTER);
l.setMaxSize(Double.MAX_VALUE, Double.MAX_VALUE);
l.getStyleClass().add("emptypanel");
VBox.setVgrow(l, Priority.SOMETIMES);
container.getChildren().add(l);
}
// Modify panel if system
if (menubutton != null) {
menubutton.setDisable(unitpage.isSystem());
}
animateListPages(-1.0);
}
示例9: createRippleEffect
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void createRippleEffect() {
circleRipple = new Circle(0.1, rippleColor);
circleRipple.setOpacity(0.0);
// Optional box blur on ripple - smoother ripple effect
// circleRipple.setEffect(new BoxBlur(3, 3, 2));
// Fade effect bit longer to show edges on the end
final FadeTransition fadeTransition = new FadeTransition(rippleDuration, circleRipple);
fadeTransition.setInterpolator(Interpolator.EASE_OUT);
fadeTransition.setFromValue(1.0);
fadeTransition.setToValue(0.0);
final Timeline scaleRippleTimeline = new Timeline();
final SequentialTransition parallelTransition = new SequentialTransition();
parallelTransition.getChildren().addAll(
scaleRippleTimeline,
fadeTransition
);
parallelTransition.setOnFinished(event1 -> {
circleRipple.setOpacity(0.0);
circleRipple.setRadius(0.1);
});
this.addEventHandler(MouseEvent.MOUSE_EXITED, event -> {
this.setCursor(Cursor.DEFAULT);
});
this.addEventHandler(MouseEvent.MOUSE_ENTERED, event -> {
this.setCursor(Cursor.HAND);
});
this.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
parallelTransition.stop();
parallelTransition.getOnFinished().handle(null);
circleRipple.setCenterX(event.getX());
circleRipple.setCenterY(event.getY());
// Recalculate ripple size if size of button from last time was changed
if (getWidth() != lastRippleWidth || getHeight() != lastRippleHeight)
{
lastRippleWidth = getWidth();
lastRippleHeight = getHeight();
rippleClip.setWidth(lastRippleWidth);
rippleClip.setHeight(lastRippleHeight);
try {
rippleClip.setArcHeight(this.getBackground().getFills().get(0).getRadii().getTopLeftHorizontalRadius());
rippleClip.setArcWidth(this.getBackground().getFills().get(0).getRadii().getTopLeftHorizontalRadius());
circleRipple.setClip(rippleClip);
} catch (Exception e) {
}
// Getting 45% of longest button's length, because we want edge of ripple effect always visible
double circleRippleRadius = Math.max(getHeight(), getWidth()) * 0.45;
final KeyValue keyValue = new KeyValue(circleRipple.radiusProperty(), circleRippleRadius, Interpolator.EASE_OUT);
final KeyFrame keyFrame = new KeyFrame(rippleDuration, keyValue);
scaleRippleTimeline.getKeyFrames().clear();
scaleRippleTimeline.getKeyFrames().add(keyFrame);
}
parallelTransition.playFromStart();
});
}
示例10: createRippleEffect
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void createRippleEffect() {
circleRipple = new Circle(0.1, rippleColor);
circleRipple.setOpacity(0.0);
// Optional box blur on ripple - smoother ripple effect
// circleRipple.setEffect(new BoxBlur(3, 3, 2));
// Fade effect bit longer to show edges on the end
final FadeTransition fadeTransition = new FadeTransition(rippleDuration, circleRipple);
fadeTransition.setInterpolator(Interpolator.EASE_OUT);
fadeTransition.setFromValue(1.0);
fadeTransition.setToValue(0.0);
final Timeline scaleRippleTimeline = new Timeline();
final SequentialTransition parallelTransition = new SequentialTransition();
parallelTransition.getChildren().addAll(
scaleRippleTimeline,
fadeTransition
);
parallelTransition.setOnFinished(event1 -> {
circleRipple.setOpacity(0.0);
circleRipple.setRadius(0.1);
});
this.addEventHandler(MouseEvent.MOUSE_PRESSED, event -> {
parallelTransition.stop();
parallelTransition.getOnFinished().handle(null);
circleRipple.setCenterX(event.getX());
circleRipple.setCenterY(event.getY());
// Recalculate ripple size if size of button from last time was changed
if (getWidth() != lastRippleWidth || getHeight() != lastRippleHeight)
{
lastRippleWidth = getWidth();
lastRippleHeight = getHeight();
rippleClip.setWidth(lastRippleWidth);
rippleClip.setHeight(lastRippleHeight);
try {
rippleClip.setArcHeight(this.getBackground().getFills().get(0).getRadii().getTopLeftHorizontalRadius());
rippleClip.setArcWidth(this.getBackground().getFills().get(0).getRadii().getTopLeftHorizontalRadius());
circleRipple.setClip(rippleClip);
} catch (Exception e) {
}
// Getting 45% of longest button's length, because we want edge of ripple effect always visible
double circleRippleRadius = Math.max(getHeight(), getWidth()) * 0.45;
final KeyValue keyValue = new KeyValue(circleRipple.radiusProperty(), circleRippleRadius, Interpolator.EASE_OUT);
final KeyFrame keyFrame = new KeyFrame(rippleDuration, keyValue);
scaleRippleTimeline.getKeyFrames().clear();
scaleRippleTimeline.getKeyFrames().add(keyFrame);
}
parallelTransition.playFromStart();
});
}
示例11: validateInput
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void validateInput() {
ValidationResult validation = this.getInputValidationCallback().call(this.getText());
if (this.previousResult != null && this.previousResult.equals(validation)) {
return;
}
this.previousResult = validation;
this.hintLabel.setText(validation.getMessage());
this.hintIcon.getStyleClass().clear();
this.hintIcon.getStyleClass().addAll("icon-pane", "message-icon");
if (validation.getIconStyleClasses().length > 0) {
this.hintIcon.getStyleClass().addAll(validation.getIconStyleClasses());
}
this.hintIcon.setOpacity(validation.getIconStyleClasses().length > 0 ? 1 : 0);
this.hintIcon.setStyle(String.format("-fx-background-color: #%02x%02x%02x%02x;",
(int)(validation.getMessageColor().getRed() * 255),
(int)(validation.getMessageColor().getGreen() * 255),
(int)(validation.getMessageColor().getBlue() * 255),
(int)(validation.getMessageColor().getOpacity() * 255)));
this.hintLabel.setTextFill(validation.messageColor);
// fade the secondary hint container in and slide it in from the top
FadeTransition secondaryFadeIn = new FadeTransition(
hintAnimationDuration, this.hintContainer);
secondaryFadeIn.setFromValue(0);
secondaryFadeIn.setToValue(1);
secondaryFadeIn.setInterpolator(hintAnimationInterpolator);
TranslateTransition secondaryTranslate = new TranslateTransition(
hintAnimationDuration, this.hintContainer);
secondaryTranslate.setFromY(-this.hintContainer.getHeight());
secondaryTranslate.setToY(0);
secondaryTranslate.setInterpolator(hintAnimationInterpolator);
// create a smooth transition for the color of the active underline
ObjectProperty<Color> highlightColor = new SimpleObjectProperty<>();
highlightColor.addListener((ov, o, n) -> {
this.activeUnderline.setStyle(String.format(
"-fx-background-color: #%02x%02x%02x%02x;",
(int)(n.getRed() * 255),
(int)(n.getGreen() * 255),
(int)(n.getBlue() * 255),
(int)(n.getOpacity() * 255)));
});
if (this.previousBackgroundColor == null) {
this.previousBackgroundColor = validation.getUnderlineColor();
}
Timeline highlightTransition = new Timeline(
new KeyFrame(Duration.ZERO, new KeyValue(highlightColor,
this.previousBackgroundColor)),
new KeyFrame(hintAnimationDuration, new KeyValue(highlightColor,
validation.getUnderlineColor(),
hintAnimationInterpolator)));
this.previousBackgroundColor = validation.getUnderlineColor();
if (this.hintAnimation != null) {
this.hintAnimation.stop();
}
this.hintAnimation = new ParallelTransition(
secondaryFadeIn,
secondaryTranslate,
highlightTransition);
this.hintAnimation.play();
}
示例12: showOrHide
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void showOrHide(
CalendarControl<T> control,
Button titleButton,
SlidingStackPane stackPane,
boolean show
) {
Duration duration = control.lengthOfAnimationsProperty().get();
if (duration.lessThanOrEqualTo(Duration.ZERO)) {
if (!show) {
titleButton.requestFocus();
}
stackPane.updateVisibility(show);
return;
}
stackPane.updateVisibility(true);
control.ongoingTransitionsProperty().set(control.ongoingTransitionsProperty().get() + 1);
TranslateTransition translateTransition = new TranslateTransition(duration, stackPane);
FadeTransition fadeTransition = new FadeTransition(duration, stackPane);
translateTransition.setInterpolator(Interpolator.EASE_OUT);
fadeTransition.setInterpolator(Interpolator.EASE_OUT);
stackPane.setCache(true);
stackPane.setCacheHint(CacheHint.SPEED);
if (show) {
translateTransition.setFromY(-stackPane.getBoundsInLocal().getHeight());
translateTransition.setToY(0);
fadeTransition.setToValue(1);
fadeTransition.setFromValue(0);
} else {
translateTransition.setToY(-stackPane.getBoundsInLocal().getHeight());
translateTransition.setFromY(0);
fadeTransition.setToValue(0);
fadeTransition.setFromValue(1);
}
this.setClip(new Rectangle(stackPane.getBoundsInLocal().getWidth(), stackPane.getBoundsInLocal().getHeight()));
ParallelTransition parallelTransition = new ParallelTransition();
parallelTransition.getChildren().add(translateTransition);
parallelTransition.getChildren().add(fadeTransition);
parallelTransition.playFromStart();
parallelTransition.setOnFinished(
actionEvent -> {
if (!show) {
titleButton.requestFocus();
stackPane.updateVisibility(false);
}
stackPane.setCache(false);
control.ongoingTransitionsProperty().set(control.ongoingTransitionsProperty().get() - 1);
}
);
}
示例13: AnimatedPopup
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
AnimatedPopup() {
super();
Interpolator interpolator = new PopupInterpolator();
showFadeTransition = new FadeTransition(Duration.seconds(0.2), getScene().getRoot());
showFadeTransition.setFromValue(0);
showFadeTransition.setToValue(1);
showFadeTransition.setInterpolator(interpolator);
showScaleTransition = new ScaleTransition(Duration.seconds(0.2), getScene().getRoot());
showScaleTransition.setFromX(0.8);
showScaleTransition.setFromY(0.8);
showScaleTransition.setToY(1);
showScaleTransition.setToX(1);
showScaleTransition.setInterpolator(interpolator);
hideFadeTransition = new FadeTransition(Duration.seconds(.3), getScene().getRoot());
hideFadeTransition.setFromValue(1);
hideFadeTransition.setToValue(0);
hideFadeTransition.setInterpolator(interpolator);
hideScaleTransition = new ScaleTransition(Duration.seconds(.3), getScene().getRoot());
hideScaleTransition.setFromX(1);
hideScaleTransition.setFromY(1);
hideScaleTransition.setToY(0.8);
hideScaleTransition.setToX(0.8);
hideScaleTransition.setInterpolator(interpolator);
hideScaleTransition.setOnFinished(
actionEvent -> {
if (AnimatedPopup.super.isShowing()) {
AnimatedPopup.super.hide();
}
}
);
this.closingHandler = (
event -> {
final Popup p = popupDialog;
if (p != null) {
p.getOwnerWindow().removeEventFilter(
WindowEvent.WINDOW_CLOSE_REQUEST,
getClosingHandler());
if (p.isShowing()) {
// first closing request will only close the popup dialog but not the window
p.hide();
event.consume();
}
popupDialog = null;
}
}
);
}