当前位置: 首页>>代码示例>>Java>>正文


Java TranslateTransition.setAutoReverse方法代码示例

本文整理汇总了Java中javafx.animation.TranslateTransition.setAutoReverse方法的典型用法代码示例。如果您正苦于以下问题:Java TranslateTransition.setAutoReverse方法的具体用法?Java TranslateTransition.setAutoReverse怎么用?Java TranslateTransition.setAutoReverse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.animation.TranslateTransition的用法示例。


在下文中一共展示了TranslateTransition.setAutoReverse方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: TranslateTransitionSample

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:21,代码来源:TranslateTransitionSample.java

示例2: animation

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public void animation(int cardid){
    TranslateTransition transition = new TranslateTransition();
    transition.setDuration(Duration.millis(150));
    transition.setNode(hash_hhcard.get(cardid));
    transition.setToY(-100);
    transition.setAutoReverse(true);
    transition.setCycleCount(2);

    transition.setOnFinished(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {
            try {
                playCard(cardid);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    });
    transition.play();

}
 
开发者ID:ESILV-FSociety,项目名称:CardGame,代码行数:23,代码来源:GameOverviewController.java

示例3: TransitionForAll

import javafx.animation.TranslateTransition; //导入方法依赖的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);
}
 
开发者ID:PBZ-InsightR,项目名称:Spellmonger3,代码行数:21,代码来源:ControllerPlay.java

示例4: autoFocusPolygonAnimated

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void autoFocusPolygonAnimated(final LocationPolygon polygon) {
    final double xScale = (foregroundPane.getBoundingBox().getWidth() / polygon.prefWidth(0))
            * Constants.ZOOM_FIT_PERCENTAGE_WIDTH;
    final double yScale = (foregroundPane.getBoundingBox().getHeight() / polygon.prefHeight(0))
            * Constants.ZOOM_FIT_PERCENTAGE_HEIGHT;
    final double scale = (xScale < yScale) ? xScale : yScale;

    final ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(500));
    scaleTransition.setToX(scale);
    scaleTransition.setToY(scale);
    scaleTransition.setCycleCount(1);
    scaleTransition.setAutoReverse(true);

    final Point2D transition = calculateTransition(scale, polygon);

    final TranslateTransition translateTransition = new TranslateTransition(Duration.millis(500));
    translateTransition.setToX(transition.getX());
    translateTransition.setToY(transition.getY());
    translateTransition.setCycleCount(1);
    translateTransition.setAutoReverse(true);

    final ParallelTransition parallelTransition
            = new ParallelTransition(this, scaleTransition, translateTransition);
    parallelTransition.play();
}
 
开发者ID:openbase,项目名称:bco.bcozy,代码行数:26,代码来源:LocationPane.java

示例5: createMiddleContent

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private Node createMiddleContent() {
    String title = "MKX Menu App";
    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);
        letters.getChildren().add(letter);

        TranslateTransition tt = new TranslateTransition(Duration.seconds(2), letter);
        tt.setDelay(Duration.millis(i * 50));
        tt.setToY(-25);
        tt.setAutoReverse(true);
        tt.setCycleCount(TranslateTransition.INDEFINITE);
        tt.play();
    }

    return letters;
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:21,代码来源:MKXMenuApp.java

示例6: animate

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
protected void animate(final ModView modView, final int amount) {
	
	 TranslateTransition tt = new TranslateTransition(Duration.millis(80), modView.getContent());
     tt.setByY(amount);
     tt.setCycleCount(1);
     tt.setAutoReverse(false);
     tt.setOnFinished(new EventHandler<ActionEvent>() {
		@Override
		public void handle(ActionEvent e) {
			modView.moving = false;
		}
	});
 
     tt.play();
	
}
 
开发者ID:KrazyTheFox,项目名称:Starbound-Mod-Manager,代码行数:17,代码来源:ModListView.java

示例7: initialize

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@Override
public void initialize(URL location, ResourceBundle resources) {
    log(CMPDL.title());
    log("Java version " + System.getProperty("java.version"));
    destinationPath.setText(System.getProperty("user.home") + File.separator + "modpack");
    if (System.getProperty("os.name").toLowerCase().contains("win")) {
        TranslateTransition transition = new TranslateTransition(Duration.seconds(1), title);
        transition.setFromY(-10);
        transition.setToY(10);
        transition.setCycleCount(Animation.INDEFINITE);
        transition.setAutoReverse(true);
        transition.play();
    }
}
 
开发者ID:Franckyi,项目名称:CMPDL,代码行数:15,代码来源:InterfaceController.java

示例8: Shaker

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public Shaker(Node node) {
    tt = new TranslateTransition(Duration.millis(100), node);
    tt.setFromX(0f);
    tt.setByX(6f);
    tt.setCycleCount(4);
    tt.setAutoReverse(true);
}
 
开发者ID:m-krajcovic,项目名称:photometric-data-retriever,代码行数:8,代码来源:Shaker.java

示例9: applyAnimation

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void applyAnimation(final StackPane group)
 {
  
  DropShadow ds = new DropShadow();
  ds.setOffsetY(3.0f);
  ds.setColor(Color.color(0.4f, 0.4f, 0.4f));
   
  Text t = new Text();
  t.setEffect(ds);
  t.setCache(true);
  t.setFill(Color.BLUE);
  t.setText("JavaFX drop shadow...");
  t.setFont(Font.font(null, FontWeight.BOLD, 32));
  
  final TranslateTransition animation = new TranslateTransition(Duration.millis(2000), t);
     animation.setFromX(-100);
     animation.setToX(100);
     animation.setAutoReverse(true);
     animation.setCycleCount(Animation.INDEFINITE);
    
     TranslateTransition animation1 = new TranslateTransition(Duration.millis(1000), t);
     animation1.setFromX(0);
     animation1.setToX(-100);
     animation1.setAutoReverse(false);
     animation1.setCycleCount(1);
     animation1.setOnFinished(new EventHandler<ActionEvent>() {
	@Override
	public void handle(ActionEvent arg0) {
		 animation.playFromStart();
	}
});
     animation1.playFromStart();
     
     group.getChildren().add(t);
  }
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:36,代码来源:MarqueTagInJavaFX.java

示例10: updatePosition

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@Override
public void updatePosition(Point2D moveBy) {
	double translateX = holder.getNode().getTranslateX();
	double translateY = holder.getNode().getTranslateY();
	Point2D playerPosition = new Point2D(translateX, translateY);

	this.position = playerPosition;
	TranslateTransition smoothMove = new TranslateTransition(
			Duration.millis(2000), this.getNode());
	smoothMove.setFromX(translateX);
	smoothMove.setFromY(translateY);
	// FIXME: Change 1000 to screenWidth()
	int leftRightDirection = 0;
	int upDownDirection = 0;
	
	switch (shootingDirection) {
	case ("west"):
		leftRightDirection = -1000;
		break;
	case ("east"):
		leftRightDirection = 1000;
		break;
	case ("north"):
		upDownDirection = -1000;
		break;
	case ("south"):
		upDownDirection = 1000;
		break;
	default:
		//some other directions?
		break;
	}
	
	smoothMove.setByX(this.getPosition().getX() + leftRightDirection);
	smoothMove.setByY(this.getPosition().getY() + upDownDirection);
	smoothMove.setAutoReverse(true);
	smoothMove.setCycleCount(1);
	smoothMove.play();
}
 
开发者ID:kpetkova,项目名称:teamearth,代码行数:40,代码来源:Bullet.java

示例11: updatePosition

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@Override
public void updatePosition(Point2D position) {
	TranslateTransition smoothMove = new TranslateTransition(
			Duration.millis(200), this.getNode());
	smoothMove.setByX(position.getX());
	smoothMove.setByY(position.getY());
	smoothMove.setAutoReverse(true);
	smoothMove.play();
}
 
开发者ID:kpetkova,项目名称:teamearth,代码行数:10,代码来源:Player.java

示例12: updatePosition

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
@Override
public void updatePosition(Point2D position) {
	TranslateTransition smoothMove = new TranslateTransition(
			Duration.millis(300), this.getNode());
	smoothMove.setByX(this.getPosition().getX() + position.getX());
	smoothMove.setByY(this.getPosition().getY() + position.getY());
	smoothMove.setAutoReverse(true);
	smoothMove.play();
}
 
开发者ID:kpetkova,项目名称:teamearth,代码行数:10,代码来源:Enemy.java

示例13: createContent

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private Parent createContent() {
    Cube c = new Cube(1, Color.GREEN);
    c.setTranslateX(-1);
    c.setRotationAxis(Rotate.Y_AXIS);
    c.setRotate(45);

    Cube c2 = new Cube(1, Color.BLUE);
    c2.setTranslateX(1);
    c2.setRotationAxis(Rotate.Y_AXIS);
    c2.setRotate(45);

    Cube c3 = new Cube(1, Color.RED);
    c3.setRotationAxis(Rotate.Y_AXIS);
    c3.setRotate(45);

    camera = new PerspectiveCamera(true);
    translate = new Translate(0, 0, -10);
    rotate = new Rotate(0, new Point3D(0, 1, 0));
    camera.getTransforms().addAll(translate, rotate);

    PointLight light = new PointLight(Color.WHITE);
    light.setTranslateX(3);
    light.setTranslateZ(-5);

    TranslateTransition tt = new TranslateTransition(Duration.seconds(2), light);
    tt.setFromX(-3);
    tt.setToX(3);
    tt.setAutoReverse(true);
    tt.setCycleCount(Animation.INDEFINITE);

    AmbientLight globalLight = new AmbientLight(Color.WHITE.deriveColor(0, 1, 0.2, 1));


    worldRoot.getChildren().addAll(c, c2, c3, globalLight, light);

    SubScene subScene = new SubScene(worldRoot, 800, 600, true, SceneAntialiasing.BALANCED);
    subScene.setCamera(camera);

    tt.play();

    return new Group(new Rectangle(800, 600), subScene);
}
 
开发者ID:AlmasB,项目名称:FXTutorials,代码行数:43,代码来源:Tutorial.java

示例14: start

import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public void start(Stage stage) throws Exception
{
    BorderPane contentPane = new BorderPane();
 
    HBox top = new HBox();
    top.getChildren().add(new Label("Top Area"));
    top.setStyle("-fx-background-color: blue");
    top.setPrefHeight(100);
    contentPane.setTop(top);
 
    HBox bottom = new HBox();
    bottom.getChildren().add(new Label("Green Area"));
    bottom.setStyle("-fx-background-color: green");
    bottom.setPrefHeight(100);
    contentPane.setBottom(bottom);
 
    HBox left = new HBox();
    left.getChildren().add(new Label("Green Area"));
    left.setStyle("-fx-background-color: yellow");
    left.setPrefWidth(100);
    contentPane.setLeft(left);
 
    HBox right = new HBox();
    right.getChildren().add(new Label("Right Area"));
    right.setStyle("-fx-background-color: red");
    right.setPrefWidth(100);
    contentPane.setRight(right);
 
    FlowPane animationArea = new FlowPane();
    Label label = new Label("Look at me, I'm flying!");
    label.setStyle("-fx-background-color: #ffd; -fx-background-radius: 3; -fx-border-color: gray; -fx-background-radius: 3; ");
    animationArea.getChildren().add(label);
    contentPane.setCenter(animationArea);
 
    Scene scene = new Scene(contentPane, 800, 600);
    scene.getStylesheets().add("styles.css");
    stage.setScene(scene);
    stage.show();
 
    TranslateTransition animation = new TranslateTransition(Duration.millis(2000), label);
    animation.setFromX(-100);
    animation.setToX(800);
    animation.setFromY(-400);
    animation.setToY(400);
    animation.setAutoReverse(true);
    animation.setCycleCount(Animation.INDEFINITE);
    animation.playFromStart();
}
 
开发者ID:SaiPradeepDandem,项目名称:javafx-demos,代码行数:49,代码来源:AnimationClipBounds.java


注:本文中的javafx.animation.TranslateTransition.setAutoReverse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。