本文整理汇总了Java中javafx.animation.TranslateTransitionBuilder类的典型用法代码示例。如果您正苦于以下问题:Java TranslateTransitionBuilder类的具体用法?Java TranslateTransitionBuilder怎么用?Java TranslateTransitionBuilder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TranslateTransitionBuilder类属于javafx.animation包,在下文中一共展示了TranslateTransitionBuilder类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TranslateTransitionSample
import javafx.animation.TranslateTransitionBuilder; //导入依赖的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();
}
示例2: start
import javafx.animation.TranslateTransitionBuilder; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
public void start() {
SequentialTransitionBuilder.create()
.children(
buildBeanAnimation(this.ratioLabel, this.ratioCircle, MTColors.RESULT_RATIO.get()),
buildBeanAnimation(this.timeLabel, this.timeBean, MTColors.RESULT_TIME.get()),
ParallelTransitionBuilder.create()
.children(
TranslateTransitionBuilder.create().node(this.monsterImage).delay(Duration.millis(500)).duration(Duration.millis(400))
.byY(-766).build(),
buildBeanAnimation(this.successLabel, this.successBean, MTColors.RESULT_SUCCESS.get()),
FadeTransitionBuilder.create().node(this.successIcon).duration(Duration.millis(500)).fromValue(0).toValue(1).build())
.build(),
ParallelTransitionBuilder.create()
.children(
buildBeanAnimation(this.failureLabel, this.failureBean, MTColors.RESULT_FAILURE.get()),
FadeTransitionBuilder.create().node(this.failureIcon).duration(Duration.millis(500)).fromValue(0).toValue(1).build())
.build()
)
.build().playFromStart();
}
示例3: handle
import javafx.animation.TranslateTransitionBuilder; //导入依赖的package包/类
public void handle(ActionEvent t) {
double parentRot = slide.getParent().getParent().getRotate();
double parentScale = slide.getParent().getParent().getScaleX();
if (parentScale != PresentationController.SCALE) {
ScaleTransitionBuilder.create()
.node(slide.getParent().getParent())
.toX(PresentationController.SCALE)
.toY(PresentationController.SCALE)
.duration(Duration.millis(600))
.onFinished(this)
.build().play();
} else if (parentRot != PresentationController.getRotation(slide.getRotate())) {
RotateTransitionBuilder.create()
.toAngle(PresentationController.getRotation(slide.getRotate()))
.node(slide.getParent().getParent())
.onFinished(this)
.duration(Duration.millis(600)).build().play();
} else {
Bounds point = slide.localToScene(slide.getBoundsInLocal());
double nowX = point.getMinX();
double nowY = point.getMinY();
TranslateTransitionBuilder.create()
.node(slide.getParent().getParent())
.byX(-nowX)
.byY(-nowY)
.interpolator(Interpolator.EASE_OUT)
.duration(Duration.millis(600))
.onFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent arg0) {
slide.toFront();
onFinished.handle(arg0);
}
})
.build().play();
}
}
开发者ID:NitorCreations,项目名称:javaone-shanghai-2013-javafx-presentation,代码行数:40,代码来源:FinishAnimator.java
示例4: makeCircle
import javafx.animation.TranslateTransitionBuilder; //导入依赖的package包/类
private Circle makeCircle(int y, int x) {
final Circle ball = CircleBuilder.create().radius(RADIUS - 1).centerX(x).centerY(y).build();
ball.setOnMouseClicked((MouseEvent mouseEvent) -> {
double newX = MOVE_WAY;
if (ball.getTranslateX() > 1) {
newX = 0;
}
TranslateTransition move = TranslateTransitionBuilder.create().node(ball).toX(newX).duration(millis(200)).build();
move.playFromStart();
});
return ball;
}
示例5: start
import javafx.animation.TranslateTransitionBuilder; //导入依赖的package包/类
@Override
public void start(Stage stage) {
String message =
"Earthrise at Christmas: " +
"[Forty] years ago this Christmas, a turbulent world " +
"looked to the heavens for a unique view of our home " +
"planet. This photo of Earthrise over the lunar horizon " +
"was taken by the Apollo 8 crew in December 1968, showing " +
"Earth for the first time as it appears from deep space. " +
"Astronauts Frank Borman, Jim Lovell and William Anders " +
"had become the first humans to leave Earth orbit, " +
"entering lunar orbit on Christmas Eve. In a historic live " +
"broadcast that night, the crew took turns reading from " +
"the Book of Genesis, closing with a holiday wish from " +
"Commander Borman: \"We close with good night, good luck, " +
"a Merry Christmas, and God bless all of you -- all of " +
"you on the good Earth.\"";
// Reference to the Text
Text textRef = TextBuilder.create()
.layoutY(100)
.textOrigin(VPos.TOP)
.textAlignment(TextAlignment.JUSTIFY)
.wrappingWidth(400)
.text(message)
.fill(Color.rgb(187, 195, 107))
.font(Font.font("SansSerif", FontWeight.BOLD, 24))
.build();
// Provides the animated scrolling behavior for the text
TranslateTransition transTransition = TranslateTransitionBuilder.create()
.duration(new Duration(75000))
.node(textRef)
.toY(-820)
.interpolator(Interpolator.LINEAR)
.cycleCount(Timeline.INDEFINITE)
.build();
Scene scene = SceneBuilder.create()
.width(516)
.height(387)
.root(
GroupBuilder.create()
.children(
ImageViewBuilder.create()
.image(new Image("http://projavafx.com/images/earthrise.jpg"))
.build(),
ScrollPaneBuilder.create()
.layoutX(50)
.layoutY(100)
.prefWidth(440)
.prefHeight(200)
.hbarPolicy(ScrollBarPolicy.NEVER)
.vbarPolicy(ScrollBarPolicy.NEVER)
.pannable(true)
.content(textRef)
.style("-fx-background-color: transparent;")
.build()
)
.build()
)
.build();
stage.setScene(scene);
stage.setTitle("Hello Earthrise");
stage.show();
// Start the text animation
transTransition.play();
}
示例6: performStepAnimation
import javafx.animation.TranslateTransitionBuilder; //导入依赖的package包/类
/**
* TODO To complete.
*
* @param nextSlide the next slide
*/
private void performStepAnimation(final Node nextSlide) {
this.subSlideTransition = ParallelTransitionBuilder.create()
.onFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent event) {
AbstractBaseView.this.currentSubSlide = nextSlide;
}
})
.children(
SequentialTransitionBuilder.create()
.node(this.currentSubSlide)
.children(
TranslateTransitionBuilder.create()
.duration(Duration.millis(400))
.fromY(0)
.toY(-700)
// .fromZ(-10)
.build(),
TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.millis(0),
new KeyValue(this.currentSubSlide.visibleProperty(),
true)),
new KeyFrame(Duration.millis(1),
new KeyValue(this.currentSubSlide.visibleProperty(),
false)))
.build())
.build(),
SequentialTransitionBuilder.create()
.node(nextSlide)
.children(
TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.millis(0),
new KeyValue(nextSlide.visibleProperty(), false)),
new KeyFrame(Duration.millis(1),
new KeyValue(nextSlide.visibleProperty(), true)))
.build(),
TranslateTransitionBuilder.create()
.duration(Duration.millis(400))
.fromY(700)
.toY(0)
// .fromZ(-10)
.build())
.build())
.build();
this.subSlideTransition.play();
}
示例7: performStepAnimation
import javafx.animation.TranslateTransitionBuilder; //导入依赖的package包/类
/**
* TODO To complete.
*
* @param nextSlide the next slide
*/
private void performStepAnimation(final Node nextSlide) {
this.subSlideTransition = ParallelTransitionBuilder.create()
.onFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(final ActionEvent event) {
BasicView.this.currentSubSlide = nextSlide;
}
})
.children(
SequentialTransitionBuilder.create()
.node(this.currentSubSlide)
.children(
TranslateTransitionBuilder.create()
.duration(Duration.millis(400))
.fromY(model().isForwardFlow() ? 0 : 0)
.toY(model().isForwardFlow() ? -700 : 700)
// .fromZ(-10)
.build(),
TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.millis(0),
new KeyValue(this.currentSubSlide.visibleProperty(),
true)),
new KeyFrame(Duration.millis(1),
new KeyValue(this.currentSubSlide.visibleProperty(),
false)))
.build())
.build(),
SequentialTransitionBuilder.create()
.node(nextSlide)
.children(
TimelineBuilder.create()
.keyFrames(
new KeyFrame(Duration.millis(0),
new KeyValue(nextSlide.visibleProperty(), false)),
new KeyFrame(Duration.millis(1),
new KeyValue(nextSlide.visibleProperty(), true)))
.build(),
TranslateTransitionBuilder.create()
.duration(Duration.millis(400))
.fromY(model().isForwardFlow() ? 700 : -700)
.toY(model().isForwardFlow() ? 0 : 0)
// .fromZ(-10)
.build())
.build())
.build();
this.subSlideTransition.play();
}