本文整理匯總了Java中javafx.animation.FadeTransition.setCycleCount方法的典型用法代碼示例。如果您正苦於以下問題:Java FadeTransition.setCycleCount方法的具體用法?Java FadeTransition.setCycleCount怎麽用?Java FadeTransition.setCycleCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.FadeTransition
的用法示例。
在下文中一共展示了FadeTransition.setCycleCount方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: ActionTextPane
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public ActionTextPane() {
actionText = new Label("Test");
graphic = new ImageView(new Image("assets/icons/editor_action_info_icon.png"));
actionText.setGraphic(graphic);
actionText.setTextFill(Utils.getDefaultTextColor());
actionText.setAlignment(Pos.CENTER);
actionText.setPadding(new Insets(0, 0, 0, 5));
getChildren().add(actionText);
setAlignment(Pos.CENTER);
ft = new FadeTransition(Duration.millis(500), graphic);
ft.setFromValue(1.0);
ft.setToValue(0.0);
ft.setAutoReverse(true);
ft.setCycleCount(4);
}
示例2: lollipop
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public static void lollipop(double x, double y) {
Circle circle = new Circle(x, y, 2);
circle.setFill(randomColor());
FrameController.instance.hover.getChildren().add(circle);
FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), circle);
fadeTransition.setAutoReverse(true);
fadeTransition.setCycleCount(2);
fadeTransition.setFromValue(0.0);
fadeTransition.setToValue(1.0);
ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(1000), circle);
scaleTransition.setToX(10.0);
scaleTransition.setToY(10.0);
scaleTransition.setCycleCount(1);
ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, scaleTransition);
parallelTransition.play();
executorService.schedule(() -> Platform.runLater(() ->
FrameController.instance.hover.getChildren().remove(circle)), 1000, TimeUnit.MILLISECONDS);
}
示例3: TransitionAlert
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void TransitionAlert(Pane player_pane, Pane energy_pane) {
Rectangle rectangle = new Rectangle(150, 50);
Stop[] stops = new Stop[]{new Stop(0, Color.RED), new Stop(1, Color.WHITE)};
LinearGradient gp = new LinearGradient(0, 0, 10, 24, true, CycleMethod.NO_CYCLE, stops);
rectangle.setFill(gp);
rectangle.setArcHeight(18);
rectangle.setArcWidth(18);
rectangle.setLayoutX(energy_pane.getLayoutX());
rectangle.setLayoutY(energy_pane.getLayoutY());
FadeTransition fadeTransition1 = new FadeTransition(Duration.millis(500), rectangle);
fadeTransition1.setFromValue(0f);
fadeTransition1.setToValue(0.6f);
fadeTransition1.setCycleCount(2);
fadeTransition1.setAutoReverse(true);
player_pane.getChildren().add(rectangle);
fadeTransition1.play();
}
示例4: TransitionGainPV
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void TransitionGainPV(Pane player_pane, Pane energy_pane) {
Rectangle rectangle = new Rectangle(150, 50);
Stop[] stops = new Stop[]{new Stop(0, Color.GREEN), new Stop(1, Color.WHITE)};
LinearGradient gp = new LinearGradient(0, 0, 10, 24, true, CycleMethod.NO_CYCLE, stops);
rectangle.setFill(gp);
rectangle.setArcHeight(18);
rectangle.setArcWidth(18);
rectangle.setLayoutX(energy_pane.getLayoutX());
rectangle.setLayoutY(energy_pane.getLayoutY());
FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), rectangle);
fadeTransition.setFromValue(0f);
fadeTransition.setToValue(0.6f);
fadeTransition.setCycleCount(2);
fadeTransition.setAutoReverse(true);
player_pane.getChildren().add(rectangle);
fadeTransition.play();
}
示例5: TransitionForAll
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void TransitionForAll(Rectangle rectangle, double layoutXFrom, double layoutXTo, double layoutYFrom, double layoutYTo) {
mainPane.getChildren().add(rectangle);
TranslateTransition translateTransition = new TranslateTransition(Duration.millis(800), rectangle);
translateTransition.setFromX(layoutXFrom);
translateTransition.setToX(layoutXTo);
translateTransition.setFromY(layoutYFrom);
translateTransition.setToY(layoutYTo);
translateTransition.setCycleCount(1);
translateTransition.setAutoReverse(true);
FadeTransition fadeTransition = new FadeTransition(Duration.millis(800), rectangle);
fadeTransition.setFromValue(1.0f);
fadeTransition.setToValue(0f);
fadeTransition.setCycleCount(1);
fadeTransition.setAutoReverse(true);
translateTransition.play();
fadeTransition.play();
rectangle.setDisable(true);
Rectangle newRectangle = new Rectangle(10, 10);
eventExit(rectangle, newRectangle);
}
示例6: refreshBadge
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void refreshBadge() {
badge.getChildren().clear();
if (enabled) {
Label labelControl = new Label(text.getValue());
StackPane badgePane = new StackPane();
badgePane.getStyleClass().add("badge-pane");
badgePane.getChildren().add(labelControl);
//Adding a clip would avoid overlap but this does not work as intended
//badgePane.setClip(clip);
badge.getChildren().add(badgePane);
StackPane.setAlignment(badge, getPosition());
FadeTransition ft = new FadeTransition(Duration.millis(666), badge);
ft.setFromValue(0);
ft.setToValue(1.0);
ft.setCycleCount(1);
ft.setAutoReverse(true);
ft.play();
}
}
示例7: createRightContent
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private Node createRightContent() {
String title = "Please Subscribe :)";
HBox letters = new HBox(0);
letters.setAlignment(Pos.CENTER);
for (int i = 0; i < title.length(); i++) {
Text letter = new Text(title.charAt(i) + "");
letter.setFont(FONT);
letter.setFill(Color.WHITE);
letter.setOpacity(0);
letters.getChildren().add(letter);
FadeTransition ft = new FadeTransition(Duration.seconds(2), letter);
ft.setDelay(Duration.millis(i * 50));
ft.setToValue(1);
ft.setAutoReverse(true);
ft.setCycleCount(TranslateTransition.INDEFINITE);
ft.play();
}
return letters;
}
示例8: ExceptionWitnessResponderButton
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
* @param origin The same origin that is passed to the
* {@link edu.wpi.grip.core.util.ExceptionWitness}
*/
@Inject
ExceptionWitnessResponderButton(@Assisted Object origin, @Assisted String popOverTitle) {
super();
this.origin = checkNotNull(origin, "The origin can not be null");
this.popOverTitle = checkNotNull(popOverTitle, "The pop over title can not be null");
this.tooltip = new Tooltip();
this.getStyleClass().add(STYLE_CLASS);
final ImageView icon = new ImageView("/edu/wpi/grip/ui/icons/warning.png");
setOnMouseClicked(event -> getPopover().show(this));
setVisible(false);
setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
setGraphic(icon);
icon.setFitWidth(DPIUtility.SMALL_ICON_SIZE);
icon.setFitHeight(DPIUtility.SMALL_ICON_SIZE);
FadeTransition ft = new FadeTransition(Duration.millis(750), icon);
ft.setToValue(0.1);
ft.setCycleCount(Transition.INDEFINITE);
ft.setAutoReverse(true);
ft.play();
}
示例9: pickGraphic
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
* Gets the graphic that should be used for the button given the current source's state
*
* @return The graphic to show on the button.
*/
private static ImageView pickGraphic(RestartableService startStoppable) {
final boolean running = startStoppable.isRunning();
final ImageView icon = running ? new ImageView(stopImage) : new ImageView(startImage);
if (!running) {
// If we are not running then we want the icon to flash
final FadeTransition ft = new FadeTransition(Duration.millis(750), icon);
ft.setToValue(0.1);
ft.setCycleCount(Transition.INDEFINITE);
ft.setAutoReverse(true);
ft.play();
}
icon.setFitHeight(DPIUtility.MINI_ICON_SIZE);
icon.setFitWidth(DPIUtility.MINI_ICON_SIZE);
return icon;
}
示例10: fadeText
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public static void fadeText(String label,StackPane stack,double x,double y,Color c){
String temp = "";
if(label.length()>50)
temp = label.substring(0, 50);
else
temp = label;
Label lb = new Label(temp);
lb.setTranslateX(x);
lb.setTranslateY(y);
lb.setTextFill(c);
lb.setStyle("-fx-font-size: 20pt;");
stack.getChildren().add(lb);
FadeTransition ft = new FadeTransition(Duration.millis(2000),lb);
ft.setFromValue(1.0);
ft.setToValue(0);
ft.setCycleCount(1);
ft.setAutoReverse(true);
ft.play();
}
示例11: createWalletHideAnimation
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private Animation createWalletHideAnimation() {
try {
FadeTransition fade = new FadeTransition(Duration.millis(1000), this.knownWalletDetailContainer);
fade.setFromValue(1.0);
fade.setToValue(0.0);
fade.setCycleCount(1);
ScaleTransition scale = new ScaleTransition(Duration.millis(1000), this.knownWalletDetailContainer);
scale.setFromX(1.0);
scale.setToX(0.1);
scale.setFromY(1.0);
scale.setToY(0.1);
scale.setCycleCount(1);
ParallelTransition parallel = new ParallelTransition();
parallel.getChildren().addAll(fade, scale);
parallel.setCycleCount(1);
return parallel;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
示例12: createWalletShowAnimation
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private Animation createWalletShowAnimation() {
try {
FadeTransition fade = new FadeTransition(Duration.millis(1000), this.knownWalletDetailContainer);
fade.setFromValue(0.0);
fade.setToValue(1.0);
fade.setCycleCount(1);
ScaleTransition scale = new ScaleTransition(Duration.millis(1000), this.knownWalletDetailContainer);
scale.setFromX(0.1);
scale.setToX(1.0);
scale.setFromY(0.1);
scale.setToY(1.0);
scale.setCycleCount(1);
ParallelTransition parallel = new ParallelTransition();
parallel.getChildren().addAll(fade, scale);
parallel.setCycleCount(1);
return parallel;
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
示例13: ImagePane
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
* Creates a new ImagePane with the given Image
* @param image
*/
public ImagePane(Image image){
imageView = new ImageView();
imageView.setSmooth(true);
imageView.fitWidthProperty().bind(widthProperty());
imageView.fitHeightProperty().bind(heightProperty());
fadeTransition =
new FadeTransition(Duration.millis(2000), imageView);
fadeTransition.setFromValue(0.0f);
fadeTransition.setToValue(1.0f);
fadeTransition.setCycleCount(1);
fadeTransition.setAutoReverse(false);
fadeTransition.setCycleCount(1);
setCenter(imageView);
imageProperty().addListener(imageChangeListener);
setImage(image);
}
示例14: wrongAnswer
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void wrongAnswer(int wrong){
//Make the strike images to appear
ArrayList<ImageView> strikemarks = new ArrayList<>();
for(int i=0; i<wrong; i++)
strikemarks.add( new ImageView(new Image(GameGUI.class.getResourceAsStream("resources/strike.png"))) );
//Make the transitions for the strikes to appear and disappear with
FadeTransition disappear = new FadeTransition(Duration.millis(50), strikes);
disappear.setFromValue(1);
disappear.setToValue(0);
disappear.setCycleCount(1);
disappear.setOnFinished(e -> strikes.getChildren().clear());
FadeTransition appear = new FadeTransition(Duration.millis(50), strikes);
appear.setFromValue(0);
appear.setToValue(1);
appear.setCycleCount(1);
appear.setOnFinished(e ->
Platform.runLater(() -> {
try{
Thread.sleep(1000); //done in a separate thread to not halt user input
}catch(Exception exc){exc.printStackTrace();}
disappear.play();
})
);
//Style the strikes and add them to the screen
for(ImageView img : strikemarks){
img.setPreserveRatio(true);
img.setFitWidth(screen.getWidth()/5);
strikes.getChildren().addAll(img);
}
//Actually play the animation
playAudio("strike.mp3");
appear.play();
}
示例15: prepareRunningAnimation
import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private FadeTransition prepareRunningAnimation( ) {
final FadeTransition transition = new FadeTransition( Duration.millis( 1500 ) );
transition.setFromValue( 1.0 );
transition.setToValue( 0.5 );
transition.setCycleCount( Timeline.INDEFINITE );
transition.setAutoReverse( true );
return transition;
}