javafx.scene.AmbientLight#javafx.animation.Animation源码实例Demo

下面列出了javafx.scene.AmbientLight#javafx.animation.Animation 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Quelea   文件: Clock.java
private void bindToTime() {
    Timeline timeline = new Timeline(
            new KeyFrame(Duration.seconds(0), (ActionEvent actionEvent) -> {
                Calendar time = Calendar.getInstance();
                String hourString;
                boolean s24h = QueleaProperties.get().getUse24HourClock();
                if (s24h) {
                    hourString = pad(2, '0', time.get(Calendar.HOUR_OF_DAY) + "");
                } else {
                    hourString = pad(2, '0', time.get(Calendar.HOUR) + "");
                }
                String minuteString = pad(2, '0', time.get(Calendar.MINUTE) + "");
                String text1 = hourString + ":" + minuteString;
        if (!s24h) {
            text1 += (time.get(Calendar.AM_PM) == Calendar.AM) ? " AM" : " PM";
        }
        setText(text1);
    }),
            new KeyFrame(Duration.seconds(1))
    );
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
 
源代码2 项目: quantumjava   文件: SpriteView.java
public void move(Main.Direction direction) {
    if (walking != null && walking.getStatus().equals(Animation.Status.RUNNING))
        return;
    int lx = location.getValue().getX();
    int ly = location.getValue().getY();
    int dx = direction.getXOffset();
    int dy = direction.getYOffset();
    if (animals.size() < 1) {
        Main.setHelpText("Visit the barn to get a qubitlamb");
    }
    if ((dx < 0 && lx <1) || (dy < 0 && ly <1)) return;
    if ((dx > 0 && lx > Main.HORIZONTAL_CELLS-2) || (dy > 0 && ly > Main.VERTICAL_CELLS-2)) return;
    moveTo(location.getValue().offset(direction.getXOffset(), direction.getYOffset()));
    animals.stream().reduce(location.get(),
        (loc, sprt) -> {
            sprt.moveTo(loc);
            return sprt.location.get();
        }, (loc1, loc2) -> loc1);
}
 
源代码3 项目: pmd-designer   文件: TestCaseListCell.java
private Animation getStatusTransition(TestStatus newStatus) {

        return new Transition() {

            {
                setCycleDuration(Duration.millis(1200));
                setInterpolator(Interpolator.EASE_BOTH);
                setOnFinished(t -> applyCss());
            }


            @Override
            protected void interpolate(double frac) {
                Color vColor = newStatus.getColor().deriveColor(0, 1, 1, clip(map(frac)));
                setBackground(new Background(new BackgroundFill(vColor, CornerRadii.EMPTY, Insets.EMPTY)));
            }

            private double map(double x) {
                return -abs(x - 0.5) + 0.5;
            }

            private double clip(double i) {
                return min(1, max(0, i));
            }
        };
    }
 
源代码4 项目: scenic-view   文件: ConnectorUtils.java
public static List<Animation> getAnimations() {
        final List<Animation> animationList = new ArrayList<>();
        
        // FIXME disabled as JavaFX 8.0 has removed the AnimationPulseReceiver class
        
//        final AbstractMasterTimer timer = ToolkitAccessor.getMasterTimer();
//        try {
//            final Field field = AbstractMasterTimer.class.getDeclaredField("receivers");
//            field.setAccessible(true);
//            @SuppressWarnings("unchecked") final PulseReceiver[] object = (PulseReceiver[]) field.get(timer);
//            for (PulseReceiver pulseReceiver : object) {
//                if (pulseReceiver instanceof AnimationPulseReceiver) {
//                    final Field field2 = AnimationPulseReceiver.class.getDeclaredField("animation");
//                    field2.setAccessible(true);
//                    final Animation animation = (Animation) field2.get(pulseReceiver);
//                    animationList.add(animation);
//                }
//            }
//        } catch (final Exception e) {
//            ScenicViewExceptionLogger.submitException(e);
//        }
        return animationList;
    }
 
源代码5 项目: JFoenix   文件: AnimationDemo.java
@Override
public Animation animateExit() {
    final Integer endValue = 0;
    return new Timeline(
        new KeyFrame(Duration.millis(300),
                     new KeyValue(main.opacityProperty(), endValue, EASE_BOTH)),
        new KeyFrame(Duration.millis(520),
                     new KeyValue(colorPane1.translateXProperty(), endValue, EASE_BOTH),
                     new KeyValue(colorPane1.translateYProperty(), endValue, EASE_BOTH)),
        new KeyFrame(Duration.millis(200),
                     new KeyValue(colorPane1.scaleXProperty(), 1, EASE_BOTH),
                     new KeyValue(colorPane1.scaleYProperty(), 1, EASE_BOTH)),
        new KeyFrame(Duration.millis(1000),
                     new KeyValue(colorPane1.scaleXProperty(), 40, EASE_BOTH),
                     new KeyValue(colorPane1.scaleYProperty(), 40, EASE_BOTH)));
}
 
源代码6 项目: netbeans   文件: ChartAdvancedStockLine.java
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setScene(new Scene(root));
    root.getChildren().add(createChart());
    // create timeline to add new data every 60th of second
    animation = new Timeline();
    animation.getKeyFrames().add(new KeyFrame(Duration.millis(1000/60), new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent actionEvent) {
            // 6 minutes data per frame
            for(int count=0; count < 6; count++) {
                nextTime();
                plotTime();
            }
        }
    }));
    animation.setCycleCount(Animation.INDEFINITE);
}
 
源代码7 项目: FXGLGames   文件: SpaceInvadersController.java
private Animation getAnimationLoseLife(Texture texture) {
    texture.setFitWidth(64);
    texture.setFitHeight(64);

    Viewport viewport = gameScene.getViewport();

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.66), texture);
    tt.setToX(viewport.getWidth() / 2 - texture.getFitWidth() / 2);
    tt.setToY(viewport.getHeight() / 2 - texture.getFitHeight() / 2);

    ScaleTransition st = new ScaleTransition(Duration.seconds(0.66), texture);
    st.setToX(0);
    st.setToY(0);

    return new SequentialTransition(tt, st);
}
 
源代码8 项目: helloiot   文件: ViewNumberChart.java
@Override
public void construct(IoTApp app) {
    super.construct(app);
    
    if (glyph != null) {
        glyphnode = new StackPane(IconBuilder.create(glyph, 36.0).styleClass("unitinputicon").build());
        glyphnode.setPadding(new Insets(0, 0, 0, 6));
        boxview.getChildren().add(0, glyphnode);
    }        
    
    device.subscribeStatus(messageHandler);

    serie = new ChartSerie();
    serie.setDevice(device);
    serie.construct();
    areachart.addShapeChart(new ShapeChartArea(serie));
           
    timeline = new Timeline(new KeyFrame(duration.divide(ChartSerie.SIZE), ae -> {
        serie.tick();
    }));  
    timeline.setCycleCount(Animation.INDEFINITE);        
    timeline.play();   
    // Do not update status all values come from messages
}
 
源代码9 项目: gluon-samples   文件: RubikView.java
public RubikView() {
    
    rubik = new Rubik();
    setCenter(rubik.getSubScene());
    
    timer = new Timeline(
        new KeyFrame(Duration.ZERO, 
            e -> clock.set(LocalTime.now().minusNanos(time.toNanoOfDay()).format(fmt))),
        new KeyFrame(Duration.seconds(1)));
    
    timer.setCycleCount(Animation.INDEFINITE);
    timeLabel = new Label();
    timeLabel.setStyle("-fx-text-fill: white; -fx-font-size: 0.9em;");
    timeLabel.textProperty().bind(clock);
    
    rubik.isSolved().addListener((ov,b,b1)->{
        if(b1){
            timer.stop();
            MobileApplication.getInstance().showMessage("Solved in " + (rubik.getCount().get() + 1) + " movements!");
        }
    });
    
    getStylesheets().add(RubikView.class.getResource("rubik.css").toExternalForm());
    addEventHandler(MouseEvent.ANY, rubik.eventHandler);
}
 
源代码10 项目: mars-sim   文件: Flyout.java
/**
 * The "do once" configuration
 */
private void defineFlyout() {
    tl.setCycleCount(1);
    loc.addListener((obs, oldY, newY) -> {
        if(flyoutSide == Side.TOP || flyoutSide == Side.TOP_RIGHT 
        		|| flyoutSide == Side.BOTTOM || flyoutSide == Side.BOTTOM_LEFT) {
            userNodeContainer.setLayoutY(newY.doubleValue());
        }else{
            userNodeContainer.setLayoutX(newY.doubleValue());
        }

    });
    tl.statusProperty().addListener((v, o, n) -> {
        if(n == Animation.Status.STOPPED) {
            if(!flyoutShowing) {
                popup.hide();
            } 
            flyOutStatus.setValue(Flyout.Status.COMPLETE);
        }else{
            flyOutStatus.setValue(Flyout.Status.RUNNING);
        }
    });
}
 
源代码11 项目: FXGLGames   文件: SpaceInvadersController.java
private Animation getAnimationLoseLife(Texture texture) {
    texture.setFitWidth(64);
    texture.setFitHeight(64);

    Viewport viewport = gameScene.getViewport();

    TranslateTransition tt = new TranslateTransition(Duration.seconds(0.66), texture);
    tt.setToX(viewport.getWidth() / 2 - texture.getFitWidth() / 2);
    tt.setToY(viewport.getHeight() / 2 - texture.getFitHeight() / 2);

    ScaleTransition st = new ScaleTransition(Duration.seconds(0.66), texture);
    st.setToX(0);
    st.setToY(0);

    return new SequentialTransition(tt, st);
}
 
源代码12 项目: training   文件: SpriteView.java
public void moveTo(Main.Location loc) {
    walking = new Timeline(Animation.INDEFINITE,
        new KeyFrame(Duration.seconds(.001), new KeyValue(direction, location.getValue().directionTo(loc))),
        new KeyFrame(Duration.seconds(.002), new KeyValue(location, loc)),
        new KeyFrame(Duration.seconds(1), new KeyValue(translateXProperty(), loc.getX() * Main.CELL_SIZE)),
        new KeyFrame(Duration.seconds(1), new KeyValue(translateYProperty(), loc.getY() * Main.CELL_SIZE)),
        new KeyFrame(Duration.seconds(.25), new KeyValue(frame, 0)),
        new KeyFrame(Duration.seconds(.5), new KeyValue(frame, 1)),
        new KeyFrame(Duration.seconds(.75), new KeyValue(frame, 2)),
        new KeyFrame(Duration.seconds(1), new KeyValue(frame, 1))
    );
    walking.setOnFinished(e -> {
        if (arrivalHandler != null) {
            arrivalHandler.handle(e);
        }
    });
    Application.invokeLater(walking::play);
}
 
源代码13 项目: quantumjava   文件: SpriteView.java
public void startValueAnimation() {
    Timeline timeline = new Timeline(Animation.INDEFINITE,
            new KeyFrame(Duration.seconds(.25), new KeyValue(value, 0)),
            new KeyFrame(Duration.seconds(.5), new KeyValue(value, 1)),
            new KeyFrame(Duration.seconds(.75), new KeyValue(value, 2)),
            new KeyFrame(Duration.seconds(1), new KeyValue(value, 1))
    );
    timeline.onFinishedProperty().setValue(e -> timeline.play());
    timeline.play();
}
 
private void initTransition() {
    transition.setAutoReverse(false);
    transition.setCycleCount(Animation.INDEFINITE);
    transition.setDelay(Duration.ZERO);
    transition.setInterpolator(Interpolator.LINEAR);
    transition.setByAngle(360);
}
 
源代码15 项目: logbook-kai   文件: BattleDetail.java
/**
 * 戦況表示を定期的に更新して表示します。
 *
 * @param supplier 戦闘ログのサプライヤー
 */
void setInterval(Supplier<BattleLog> supplier) {
    this.timeline.setCycleCount(Animation.INDEFINITE);
    this.timeline.getKeyFrames().add(new KeyFrame(javafx.util.Duration.millis(1000),
            e -> this.setData(supplier.get())));
    this.timeline.play();
}
 
源代码16 项目: chart-fx   文件: ChartLayoutAnimator.java
/**
 * Play a animation containing the given keyframes.
 *
 * @param animation The animation to play
 * @return A id reference to the animation that can be used to stop the animation if needed
 */
public Object animate(Animation animation) {
    SequentialTransition t = new SequentialTransition();
    t.getChildren().add(animation);
    t.setOnFinished(this);
    // start animation timer if needed
    if (activeTimeLines.isEmpty())
        start();
    // get id and add to map
    activeTimeLines.put(t, t);
    // play animation
    t.play();
    return t;

}
 
源代码17 项目: chart-fx   文件: DataViewerSample.java
private static Pane getDemoPane() {
    final Rectangle rect = new Rectangle(-130, -40, 80, 80);
    rect.setFill(Color.BLUE);
    final Circle circle = new Circle(0, 0, 40);
    circle.setFill(Color.GREEN);
    final Polygon triangle = new Polygon(60, -40, 120, 0, 50, 40);
    triangle.setFill(Color.RED);

    final Group group = new Group(rect, circle, triangle);
    group.setTranslateX(300);
    group.setTranslateY(200);

    final RotateTransition rotateTransition = new RotateTransition(Duration.millis(4000), group);
    rotateTransition.setByAngle(3.0 * 360);
    rotateTransition.setCycleCount(Animation.INDEFINITE);
    rotateTransition.setAutoReverse(true);
    rotateTransition.play();

    final RotateTransition rotateTransition1 = new RotateTransition(Duration.millis(1000), rect);
    rotateTransition1.setByAngle(360);
    rotateTransition1.setCycleCount(Animation.INDEFINITE);
    rotateTransition1.setAutoReverse(false);
    rotateTransition1.play();

    final RotateTransition rotateTransition2 = new RotateTransition(Duration.millis(1000), triangle);
    rotateTransition2.setByAngle(360);
    rotateTransition2.setCycleCount(Animation.INDEFINITE);
    rotateTransition2.setAutoReverse(false);
    rotateTransition2.play();
    group.setManaged(true);

    HBox.setHgrow(group, Priority.ALWAYS);
    final HBox box = new HBox(group);
    VBox.setVgrow(box, Priority.ALWAYS);
    box.setId("demoPane");
    return box;
}
 
源代码18 项目: diirt   文件: ExpressionProbe.java
public void startTimer() {
    stopTimer();

    timeline = new Timeline(new KeyFrame(
            Duration.millis(2500),
            ae -> channelInfo()));
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
 
源代码19 项目: scenic-view   文件: SVAnimation.java
public SVAnimation(final int id, final Animation animation) {
    this.id = id;
    this.toString = animation.toString();
    this.rate = animation.getRate();
    this.currentRate = animation.getCurrentRate();
    this.status = animation.getStatus().toString();
    this.cycleCount = animation.getCycleCount();
    this.cycleDuration = animation.getCycleDuration().toString();
    this.currentTime = ((int) animation.getCurrentTime().toMillis()) + "ms";
    this.totalDuration = ((int) animation.getTotalDuration().toMillis()) + "ms";
}
 
源代码20 项目: oim-fx   文件: HeadItem.java
public void setPulse(boolean pulse) {
	this.pulse = pulse;
	if (!pulse) {
		if (animation.getStatus() == Animation.Status.RUNNING) {
			animation.stop();
		}
	} else {
		animation.play();
	}
}
 
源代码21 项目: oim-fx   文件: SimpleHead.java
public void setPulse(boolean pulse) {
	this.pulse = pulse;
	if (!pulse) {
		if (animation.getStatus() == Animation.Status.RUNNING) {
			animation.stop();
		}
		label.setText(text);
	} else {
		animation.play();
	}
}
 
源代码22 项目: oim-fx   文件: HeadItem.java
private void iniEvent() {

		// animation.setAutoReverse(true);
		animation.setCycleCount(Animation.INDEFINITE);

		KeyValue kx1 = new KeyValue(headPane.layoutXProperty(), headPane.getLayoutX() + 1);
		KeyValue ky1 = new KeyValue(headPane.layoutYProperty(), headPane.getLayoutY() - 1);

		KeyValue kx2 = new KeyValue(headPane.layoutXProperty(), headPane.getLayoutX() + 1);
		KeyValue ky2 = new KeyValue(headPane.layoutYProperty(), headPane.getLayoutY() + 1);

		KeyValue kx3 = new KeyValue(headPane.layoutXProperty(), headPane.getLayoutX() - 1);
		KeyValue ky3 = new KeyValue(headPane.layoutYProperty(), headPane.getLayoutY() - 1);

		KeyValue kx4 = new KeyValue(headPane.layoutXProperty(), headPane.getLayoutX() - 1);
		KeyValue ky4 = new KeyValue(headPane.layoutYProperty(), headPane.getLayoutY() + 1);

		KeyFrame kfx1 = new KeyFrame(new Duration(160), kx1);
		KeyFrame kfy1 = new KeyFrame(new Duration(160), ky1);
		KeyFrame kfx2 = new KeyFrame(new Duration(320), kx2);
		KeyFrame kfy2 = new KeyFrame(new Duration(320), ky2);
		KeyFrame kfx3 = new KeyFrame(new Duration(480), kx3);
		KeyFrame kfy3 = new KeyFrame(new Duration(480), ky3);
		KeyFrame kfx4 = new KeyFrame(new Duration(640), kx4);
		KeyFrame kfy4 = new KeyFrame(new Duration(640), ky4);

		animation.getKeyFrames().add(kfx1);
		animation.getKeyFrames().add(kfy1);
		animation.getKeyFrames().add(kfx2);
		animation.getKeyFrames().add(kfy2);
		animation.getKeyFrames().add(kfx3);
		animation.getKeyFrames().add(kfy3);
		animation.getKeyFrames().add(kfx4);
		animation.getKeyFrames().add(kfy4);

	}
 
源代码23 项目: oim-fx   文件: HeadItem.java
public void setPulse(boolean pulse) {
	this.pulse = pulse;
	if (!pulse) {
		if (animation.getStatus() == Animation.Status.RUNNING) {
			animation.stop();
		}
	} else {
		animation.play();
	}
}
 
源代码24 项目: Quelea   文件: Timer.java
private void bindToTime() {
    int starttime = minutes * 60 + seconds;
    setText(pretext + (minutes > 9 ? "" : "0") + minutes + ":" + (seconds > 9 ? "" : "0") + seconds + posttext);
    timeline = new Timeline(
            new KeyFrame(Duration.seconds(1),
                    new EventHandler<ActionEvent>() {
                        private int count = 0;

                        @Override
                        public void handle(ActionEvent actionEvent) {
                            if (!paused) {
                                count++;
                            }
                            if (reset) {
                                count = 0;
                                reset = false;
                            }
                            int remaining = starttime - count;
                            if (remaining >= 0) {
                                setText(pretext + ((remaining / 60) > 9 ? "" : "0") + (int) Math.floor(remaining / 60) + ":" + ((remaining % 60) > 9 ? "" : "0") + remaining % 60 + posttext);
                            }
                        }
                    }
            )
    );
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
 
源代码25 项目: MusicPlayer   文件: ArtistsController.java
@Override
public void scroll(char letter) {
	
	int index = 0;
	double cellHeight = 0;
	ObservableList<Node> children = grid.getChildren();

    for (Node node : children) {

        VBox cell = (VBox) node;
        cellHeight = cell.getHeight();
        Label label = (Label) cell.getChildren().get(1);
        char firstLetter = removeArticle(label.getText()).charAt(0);
        if (firstLetter < letter) {
            index++;
        }
    }
	
	ScrollPane scrollpane = MusicPlayer.getMainController().getScrollPane();
	
	double row = (index / 5) * cellHeight;
	double finalVvalue = row / (grid.getHeight() - scrollpane.getHeight());
	double startVvalue = scrollpane.getVvalue();
	
	Animation scrollAnimation = new Transition() {
        {
            setCycleDuration(Duration.millis(500));
        }
        protected void interpolate(double frac) {
            double vValue = startVvalue + ((finalVvalue - startVvalue) * frac);
            scrollpane.setVvalue(vValue);
        }
    };
    
    scrollAnimation.play();
}
 
源代码26 项目: CrazyAlpha   文件: GameView.java
public static void makeScaleTransition(Node node, int millis, double byX, double byY) {
    ScaleTransition st = new ScaleTransition(Duration.millis(millis));
    st.setByX(byX);
    st.setByY(byY);
    st.setCycleCount(Animation.INDEFINITE);
    st.setAutoReverse(true);
    st.setNode(node);
    st.play();
}
 
源代码27 项目: FXyzLib   文件: CameraController.java
public CameraController(boolean enableTransforms, AnimationPreference movementType) {
    enable = enableTransforms;
    animPref = movementType;
    switch (animPref) {
        case TIMELINE:
            timeline = new Timeline();
            timeline.setCycleCount(Animation.INDEFINITE);
            break;
        case TIMER:
            timer = new AnimationTimer() {
                @Override
                public void handle(long l) {
                    if (enable) {
                        initialize();
                        enable = false;
                    }
                    update();
                }
            };
            break;
        case TRANSITION:
            transition = new Transition() {
                {setCycleDuration(Duration.seconds(1));}
                @Override
                protected void interpolate(double frac) {
                    updateTransition(frac);
                }
            };
            transition.setCycleCount(Animation.INDEFINITE);
            break;
        case ANIMATION:
            
            break;
    }

}
 
源代码28 项目: CrazyAlpha   文件: GameView.java
public static void makeRotateTransition(Node node, int mills, double fromAngle, double toAngle, boolean autoReverse) {
    RotateTransition rt = new RotateTransition(Duration.millis(mills));
    rt.setFromAngle(fromAngle);
    rt.setToAngle(toAngle);
    rt.setAutoReverse(autoReverse);
    rt.setCycleCount(Animation.INDEFINITE);
    rt.setNode(node);
    rt.play();
}
 
源代码29 项目: JavaFX-Tutorial-Codes   文件: MainViewController.java
@Override
public void initialize(URL url, ResourceBundle rb) {
    timeline = new Timeline();
    KeyFrame keyFrame = new KeyFrame(Duration.millis(Constants.TEXT_INTERVAL), (ActionEvent event) -> {
        handleText();
    });
    timeline.getKeyFrames().add(keyFrame);
    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.play();
}
 
源代码30 项目: marathonv5   文件: AdvancedStockLineChartSample.java
public AdvancedStockLineChartSample() {
    getChildren().add(createChart());
    // create timeline to add new data every 60th of second
    animation = new Timeline();
    animation.getKeyFrames().add(new KeyFrame(Duration.millis(1000/60), new EventHandler<ActionEvent>() {
        @Override public void handle(ActionEvent actionEvent) {
            // 6 minutes data per frame
            for(int count=0; count < 6; count++) {
                nextTime();
                plotTime();
            }
        }
    }));
    animation.setCycleCount(Animation.INDEFINITE);
}