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


Java Timeline.setAutoReverse方法代码示例

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


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

示例1: animiereRechteck

import javafx.animation.Timeline; //导入方法依赖的package包/类
public static Pane animiereRechteck() {

        Random random = new Random();

        Pane animationPane = new Pane();
        animationPane.setPrefSize(500,200);

        Rectangle rect = new Rectangle(75, 75, 100, 50);
        animationPane.getChildren().add(rect);

        Timeline timeline = new Timeline();
        timeline.setCycleCount(Timeline.INDEFINITE);
        timeline.setAutoReverse(true);

        KeyValue kVMoveX = new KeyValue(rect.xProperty(), random.nextInt(200) + 200);
        KeyValue kVRotate = new KeyValue(rect.rotateProperty(), random.nextInt(360) + 180);
        KeyValue kVArcHeight = new KeyValue(rect.arcHeightProperty(), 60);
        KeyValue kVArcWidth = new KeyValue(rect.arcWidthProperty(), 60);
        
        KeyFrame keyFrame = new KeyFrame(Duration.millis(random.nextInt(2000) + 2000), kVMoveX, kVRotate, kVArcHeight, kVArcWidth);

        timeline.getKeyFrames().add(keyFrame);
        timeline.play();

        return animationPane;
    }
 
开发者ID:CAPTNCAPS,项目名称:java.IF17wi,代码行数:27,代码来源:Rechteck.java

示例2: TimelineSample

import javafx.animation.Timeline; //导入方法依赖的package包/类
public TimelineSample() {
    super(280,120);

    //create a circle
    final Circle circle = new Circle(25,25, 20,  Color.web("1c89f4"));
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
    timeline = new Timeline();        
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can start/pause/stop/play animation by
    //timeline.play();
    //timeline.pause();
    //timeline.stop();
    //timeline.playFromStart();
    
    //add the following keyframes to the timeline
    timeline.getKeyFrames().addAll
        (new KeyFrame(Duration.ZERO,
                      new KeyValue(circle.translateXProperty(), 0)),
         new KeyFrame(new Duration(4000),
                      new KeyValue(circle.translateXProperty(), 205)));


    getChildren().add(createNavigation());
    getChildren().add(circle);
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Timeline rate", timeline.rateProperty(), -4d, 4d)
            //TODO it is possible to do it for integer?
    );
    // END REMOVE ME
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:36,代码来源:TimelineSample.java

示例3: Metronome

import javafx.animation.Timeline; //导入方法依赖的package包/类
public Metronome() {
    // création du fond du métronome
    ImageView fond_metronome = new ImageView(
            new Image(Metronome.class.getResourceAsStream("images/metronome.png")));
    fond_metronome.setFitHeight(40);
    fond_metronome.setPreserveRatio(true);

    // création de l'aiguille du métronome
    ImageView aiguille = new ImageView(new Image(Metronome.class.getResourceAsStream("images/aiguille.png")));
    aiguille.setFitHeight(32);
    aiguille.setPreserveRatio(true);
    aiguille.setTranslateX(16);
    aiguille.setTranslateY(2);

    // on applique une transformation à l'aiguille
    Rotate rotation = new Rotate(0, 3, 29);
    aiguille.getTransforms().add(rotation);

    // création de l'animation de l'aiguille
    Timeline timeline = new Timeline();
    timeline.getKeyFrames().addAll(new KeyFrame(Duration.ZERO, new KeyValue(rotation.angleProperty(), 45)),
            new KeyFrame(new Duration(1000), new KeyValue(rotation.angleProperty(), -45)));
    timeline.setAutoReverse(true);
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.play();

    this.getChildren().add(fond_metronome);
    this.getChildren().add(aiguille);
    this.setTranslateX(400);
    this.setTranslateY(200);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:32,代码来源:Metronome.java

示例4: animateGraph

import javafx.animation.Timeline; //导入方法依赖的package包/类
private void animateGraph(long timeMillis) {
    Timeline beat = new Timeline(
        new KeyFrame(Duration.millis(timeMillis),         event -> animationStep(timeMillis))
    );
    beat.setAutoReverse(true);
    beat.setCycleCount(1);
    beat.play();
}
 
开发者ID:katharinebeaumont,项目名称:Cluster,代码行数:9,代码来源:Cluster.java

示例5: init

import javafx.animation.Timeline; //导入方法依赖的package包/类
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 260,100));
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    root.getChildren().add(stack);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:56,代码来源:TimelineEvents.java

示例6: TimelineEventsSample

import javafx.animation.Timeline; //导入方法依赖的package包/类
public TimelineEventsSample() {
    super(70,70);
    //create a circle with effect
    final Circle circle = new Circle(20,  Color.rgb(156,216,255));
    circle.setEffect(new Lighting());
    //create a text inside a circle
    final Text text = new Text (i.toString());
    text.setStroke(Color.BLACK);
    //create a layout for circle with text inside
    final StackPane stack = new StackPane();
    stack.getChildren().addAll(circle, text);
    stack.setLayoutX(30);
    stack.setLayoutY(30);

    //create a timeline for moving the circle

    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //one can add a specific action when each frame is started. There are one or more frames during
    // executing one KeyFrame depending on set Interpolator.
    timer = new AnimationTimer() {
        @Override
        public void handle(long l) {
            text.setText(i.toString());
            i++;
        }

    };

    //create a keyValue with factory: scaling the circle 2times
    KeyValue keyValueX = new KeyValue(stack.scaleXProperty(), 2);
    KeyValue keyValueY = new KeyValue(stack.scaleYProperty(), 2);

    //create a keyFrame, the keyValue is reached at time 2s
    Duration duration = Duration.seconds(2);
    //one can add a specific action when the keyframe is reached
    EventHandler<ActionEvent> onFinished = new EventHandler<ActionEvent>() {
        public void handle(ActionEvent t) {
             stack.setTranslateX(java.lang.Math.random()*200-100);
             //reset counter
             i = 0;
        }
    };

    KeyFrame keyFrame = new KeyFrame(duration, onFinished , keyValueX, keyValueY);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    getChildren().add(stack);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:54,代码来源:TimelineEventsSample.java

示例7: setAnimation

import javafx.animation.Timeline; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void setAnimation(){
	// Initially hiding the Top Pane
	clipRect = new Rectangle();
	clipRect.setWidth(boxBounds.getWidth());
	clipRect.setHeight(0);
	clipRect.translateYProperty().set(boxBounds.getWidth());
	laytable.setClip(clipRect);
	laytable.translateYProperty().set(-boxBounds.getWidth());

	// Animation for bouncing effect.
	final Timeline timelineBounce = new Timeline();
	timelineBounce.setCycleCount(2);
	timelineBounce.setAutoReverse(true);
	final KeyValue kv1 = new KeyValue(clipRect.heightProperty(), (boxBounds.getHeight()-15));
	final KeyValue kv2 = new KeyValue(clipRect.translateYProperty(), 15);
	final KeyValue kv3 = new KeyValue(laytable.translateYProperty(), -15);
	final KeyFrame kf1 = new KeyFrame(Duration.millis(100), kv1, kv2, kv3);
	timelineBounce.getKeyFrames().add(kf1);

	// Event handler to call bouncing effect after the scroll down is finished.
	EventHandler onFinished = new EventHandler() {
		@Override
		public void handle(Event event) {
			timelineBounce.play();
		}
	};

	timelineDown = new Timeline();
	timelineUp = new Timeline();

	// Animation for scroll down.
	timelineDown.setCycleCount(1);
	timelineDown.setAutoReverse(true);
	final KeyValue kvDwn1 = new KeyValue(clipRect.heightProperty(), boxBounds.getWidth());
	final KeyValue kvDwn2 = new KeyValue(clipRect.translateYProperty(), 0);
	final KeyValue kvDwn3 = new KeyValue(laytable.translateYProperty(), 0);
	final KeyFrame kfDwn = new KeyFrame(Duration.millis(1000), onFinished, kvDwn1, kvDwn2, kvDwn3);
	timelineDown.getKeyFrames().add(kfDwn);

	// Animation for scroll up.
	timelineUp.setCycleCount(1); 
	timelineUp.setAutoReverse(true);
	final KeyValue kvUp1 = new KeyValue(clipRect.heightProperty(), 0);
	final KeyValue kvUp2 = new KeyValue(clipRect.translateYProperty(), boxBounds.getHeight());
	final KeyValue kvUp3 = new KeyValue(laytable.translateYProperty(), -boxBounds.getHeight());
	final KeyFrame kfUp = new KeyFrame(Duration.millis(1000), kvUp1, kvUp2, kvUp3);
	timelineUp.getKeyFrames().add(kfUp);

}
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:51,代码来源:AllAttendance.java

示例8: setAnimation

import javafx.animation.Timeline; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void setAnimation(){
	  // Initially hiding the Top Pane
	  clipRect = new Rectangle();
	  clipRect.setWidth(boxBounds.getWidth());
	  clipRect.setHeight(0);
	  clipRect.translateYProperty().set(boxBounds.getWidth());
	  laytable.setClip(clipRect);
	  laytable.translateYProperty().set(-boxBounds.getWidth());
	 
	  // Animation for bouncing effect.
	  final Timeline timelineBounce = new Timeline();
	  timelineBounce.setCycleCount(2);
	  timelineBounce.setAutoReverse(true);
	  final KeyValue kv1 = new KeyValue(clipRect.heightProperty(), (boxBounds.getHeight()-15));
	  final KeyValue kv2 = new KeyValue(clipRect.translateYProperty(), 15);
	  final KeyValue kv3 = new KeyValue(laytable.translateYProperty(), -15);
	  final KeyFrame kf1 = new KeyFrame(Duration.millis(100), kv1, kv2, kv3);
	  timelineBounce.getKeyFrames().add(kf1);
	  
	  // Event handler to call bouncing effect after the scroll down is finished.
	  EventHandler onFinished = new EventHandler() {
				@Override
				public void handle(Event event) {
					timelineBounce.play();
				}
	        };
	        
	        timelineDown = new Timeline();
	        timelineUp = new Timeline();
	        
	        // Animation for scroll down.
	  timelineDown.setCycleCount(1);
	  timelineDown.setAutoReverse(true);
	  final KeyValue kvDwn1 = new KeyValue(clipRect.heightProperty(), boxBounds.getWidth());
	  final KeyValue kvDwn2 = new KeyValue(clipRect.translateYProperty(), 0);
	  final KeyValue kvDwn3 = new KeyValue(laytable.translateYProperty(), 0);
	  final KeyFrame kfDwn = new KeyFrame(Duration.millis(1000), onFinished, kvDwn1, kvDwn2, kvDwn3);
	  timelineDown.getKeyFrames().add(kfDwn);
	  
	  // Animation for scroll up.
	  timelineUp.setCycleCount(1); 
	  timelineUp.setAutoReverse(true);
	  final KeyValue kvUp1 = new KeyValue(clipRect.heightProperty(), 0);
	  final KeyValue kvUp2 = new KeyValue(clipRect.translateYProperty(), boxBounds.getHeight());
	  final KeyValue kvUp3 = new KeyValue(laytable.translateYProperty(), -boxBounds.getHeight());
	  final KeyFrame kfUp = new KeyFrame(Duration.millis(1000), kvUp1, kvUp2, kvUp3);
	  timelineUp.getKeyFrames().add(kfUp);
	  
	 }
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:51,代码来源:Office_Entry.java

示例9: setAnimation

import javafx.animation.Timeline; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void setAnimation(){
  // Initially hiding the Top Pane
  clipRect = new Rectangle();
        clipRect.setWidth(boxBounds.getWidth());
  clipRect.setHeight(0);
  clipRect.translateYProperty().set(boxBounds.getWidth());
  layall.setClip(clipRect);
  layall.translateYProperty().set(-boxBounds.getWidth());
  
  layoffice.translateYProperty().set(-boxBounds.getWidth());
  
  // Animation for bouncing effect.
  final Timeline timelineBounce = new Timeline();
  timelineBounce.setCycleCount(2);
  timelineBounce.setAutoReverse(true);
  final KeyValue kv1 = new KeyValue(clipRect.heightProperty(), (boxBounds.getHeight()-15));
  final KeyValue kv2 = new KeyValue(clipRect.translateYProperty(), 15);
  final KeyValue kv3 = new KeyValue(layall.translateYProperty(), -15);
  final KeyFrame kf1 = new KeyFrame(Duration.millis(100), kv1, kv2, kv3);
  timelineBounce.getKeyFrames().add(kf1);
  
  // Event handler to call bouncing effect after the scroll down is finished.
  EventHandler onFinished = new EventHandler() {
			@Override
			public void handle(Event event) {
				timelineBounce.play();
			}
        };

        
        timelineDown = new Timeline();
        timelineUp = new Timeline();
        timelineoffice= new Timeline();
       
        // Animation for scroll down.
  timelineDown.setCycleCount(1);
  timelineDown.setAutoReverse(true);
  final KeyValue kvDwn1 = new KeyValue(clipRect.heightProperty(), boxBounds.getWidth());
  final KeyValue kvDwn2 = new KeyValue(clipRect.translateYProperty(), 0);
  final KeyValue kvDwn3 = new KeyValue(layall.translateYProperty(), 0);
  final KeyValue kvDwn4 = new KeyValue(layoffice.translateYProperty(), -boxBounds.getHeight()-190);
  final KeyFrame kfDwn = new KeyFrame(Duration.millis(1000), onFinished, kvDwn1, kvDwn2, kvDwn3, kvDwn4);
  timelineDown.getKeyFrames().add(kfDwn);
  
  // Animation for scroll up.
  timelineUp.setCycleCount(1); 
  timelineUp.setAutoReverse(true);
  final KeyValue kvUp1 = new KeyValue(clipRect.heightProperty(), 0);
  final KeyValue kvUp2 = new KeyValue(clipRect.translateYProperty(), boxBounds.getHeight());
  final KeyValue kvUp3 = new KeyValue(layall.translateYProperty(), -boxBounds.getHeight()-190);
  final KeyValue kvUp4 = new KeyValue(layoffice.translateYProperty(), -boxBounds.getHeight()-190);
  final KeyFrame kfUp = new KeyFrame(Duration.millis(1000), kvUp1, kvUp2, kvUp3, kvUp4);
  timelineUp.getKeyFrames().add(kfUp);
  
  //Animation for the scrollside
  timelineoffice.setCycleCount(1);
  timelineoffice.setAutoReverse(true);
  final KeyValue kvside1 = new KeyValue(clipRect.heightProperty(), boxBounds.getWidth());
  final KeyValue kvside2 = new KeyValue(clipRect.translateYProperty(), 0);
  final KeyValue kvside3 = new KeyValue(layoffice.translateYProperty(), 0);
  final KeyValue kvside4 = new KeyValue(layall.translateYProperty(), -boxBounds.getHeight());
  final KeyFrame kfside = new KeyFrame(Duration.millis(1000), kvside1, kvside2, kvside3, kvside4);
  timelineoffice.getKeyFrames().add(kfside);
  
 }
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:67,代码来源:MainWindow.java

示例10: setAnimation

import javafx.animation.Timeline; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
private void setAnimation(){
	  // Initially hiding the Top Pane
	  clipRect = new Rectangle();
	        clipRect.setWidth(boxBounds.getWidth());
	  clipRect.setHeight(0);
	  clipRect.translateXProperty().set(boxBounds.getWidth());
	  topPane.setClip(clipRect);
	  topPane.translateXProperty().set(-boxBounds.getWidth());
	  
	  thirdpane.translateXProperty().set(-boxBounds.getWidth());
	  
	  fourthpane.translateXProperty().set(-boxBounds.getWidth());
	  
	  // Animation for bouncing effect.
	  final Timeline timelineBounce = new Timeline();
	  timelineBounce.setCycleCount(2);
	  timelineBounce.setAutoReverse(true);
	  final KeyValue kv1 = new KeyValue(clipRect.heightProperty(), (boxBounds.getHeight()-15));
	  final KeyValue kv2 = new KeyValue(clipRect.translateYProperty(), 15);
	  final KeyValue kv3 = new KeyValue(topPane.translateYProperty(), -15);
	  final KeyFrame kf1 = new KeyFrame(Duration.millis(100), kv1, kv2, kv3);
	  timelineBounce.getKeyFrames().add(kf1);
	  
	  // Event handler to call bouncing effect after the scroll down is finished.
	  EventHandler onFinished = new EventHandler() {
				@Override
				public void handle(Event event) {
					timelineBounce.play();
				}
	        };
	        
	        timelineDown = new Timeline();
	        timelineUp = new Timeline();
	        timelinethree= new Timeline();
	        timelinefour= new Timeline();
	        // Animation for scroll down.
	  timelineDown.setCycleCount(1);
	  timelineDown.setAutoReverse(true);
	  final KeyValue kvDwn1 = new KeyValue(clipRect.heightProperty(), boxBounds.getWidth());
	  final KeyValue kvDwn2 = new KeyValue(clipRect.translateXProperty(), 0);
	  final KeyValue kvDwn3 = new KeyValue(topPane.translateXProperty(), 0);
	  final KeyValue kvDwn4 = new KeyValue(thirdpane.translateXProperty(), -boxBounds.getHeight());
	  final KeyValue kvDwn5 = new KeyValue(fourthpane.translateXProperty(), -boxBounds.getHeight());
	  final KeyFrame kfDwn = new KeyFrame(Duration.millis(1000), onFinished, kvDwn1, kvDwn2, kvDwn3, kvDwn4, kvDwn5);
	  timelineDown.getKeyFrames().add(kfDwn);
	  
	  // Animation for scroll up.
	  timelineUp.setCycleCount(1); 
	  timelineUp.setAutoReverse(true);
	  final KeyValue kvUp1 = new KeyValue(clipRect.heightProperty(), 0);
	  final KeyValue kvUp2 = new KeyValue(clipRect.translateXProperty(), boxBounds.getHeight());
	  final KeyValue kvUp3 = new KeyValue(topPane.translateXProperty(), -boxBounds.getHeight());
	  final KeyValue kvUp4 = new KeyValue(thirdpane.translateXProperty(), -boxBounds.getHeight());
	  final KeyValue kvUp5 = new KeyValue(fourthpane.translateXProperty(), -boxBounds.getHeight());
	  final KeyFrame kfUp = new KeyFrame(Duration.millis(1000), kvUp1, kvUp2, kvUp3, kvUp4, kvUp5);
	  timelineUp.getKeyFrames().add(kfUp);
	  
	  //Animation for the scrollside
	  timelinethree.setCycleCount(1);
	  timelinethree.setAutoReverse(true);
	  final KeyValue kvside1 = new KeyValue(clipRect.heightProperty(), boxBounds.getWidth());
	  final KeyValue kvside2 = new KeyValue(clipRect.translateXProperty(), 0);
	  final KeyValue kvside3 = new KeyValue(thirdpane.translateXProperty(), 0);
	  final KeyValue kvside4 = new KeyValue(fourthpane.translateXProperty(), -boxBounds.getHeight());
	  final KeyFrame kfside = new KeyFrame(Duration.millis(1000), kvside1, kvside2, kvside3, kvside4);
	  timelinethree.getKeyFrames().add(kfside);
	  
	  timelinefour.setCycleCount(1);
	  timelinefour.setAutoReverse(true);
	  final KeyValue kvfourth1 = new KeyValue(clipRect.heightProperty(), boxBounds.getWidth());
	  final KeyValue kvfourth2 = new KeyValue(clipRect.translateXProperty(), 0);
	  final KeyValue kvfourth3 = new KeyValue(fourthpane.translateXProperty(), 0);
	  final KeyFrame kffourth = new KeyFrame(Duration.millis(1000), kvfourth1, kvfourth2, kvfourth3);
	  timelinefour.getKeyFrames().add(kffourth);
	 }
 
开发者ID:mikemacharia39,项目名称:gatepass,代码行数:77,代码来源:Help.java


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