本文整理汇总了Java中javafx.animation.Transition.setOnFinished方法的典型用法代码示例。如果您正苦于以下问题:Java Transition.setOnFinished方法的具体用法?Java Transition.setOnFinished怎么用?Java Transition.setOnFinished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.animation.Transition
的用法示例。
在下文中一共展示了Transition.setOnFinished方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: to
import javafx.animation.Transition; //导入方法依赖的package包/类
/**
* Create an operation dragging from an absolute position to another absolute
* position in the provided duration
*
* @param d
* the duration
* @param fromX
* the start x coordinate on screen
* @param fromY
* the start y coordinate on screen
* @param toX
* the end x coordinate on screen
* @param toY
* the end y coordinate on screen
* @return the operation
*/
public static Operation to(Duration d, double fromX, double fromY, double toX, double toY) {
return (r) -> {
r.mouseMoveTo((int) fromX, (int) fromY);
BlockCondition<Void> b = new BlockCondition<>();
double dx = toX - fromX;
double dy = toY - fromY;
Transition tt = new Transition() {
{
setCycleDuration(javafx.util.Duration.millis(d.toMillis()));
}
@Override
protected void interpolate(double frac) {
r.mouseMoveTo((int) (fromX + dx * frac), (int) (fromY + dy * frac));
}
};
tt.setOnFinished(e -> b.release(null));
tt.play();
r.block(b);
return r;
};
}
示例2: by
import javafx.animation.Transition; //导入方法依赖的package包/类
/**
* Create an operation dragging from an absolute position to a relative position
* from there
*
* @param d
* the duration
* @param fromX
* the start x coordinate on screen
* @param fromY
* the start y coordinate on screen
* @param dx
* delta of the x coordinate
* @param dy
* delta of the y coordinate
* @return the operation
*/
public static Operation by(Duration d, double fromX, double fromY, double dx, double dy) {
return (r) -> {
r.mouseMoveTo((int) fromX, (int) fromY);
r.press(MouseButton.PRIMARY);
BlockCondition<Void> b = new BlockCondition<>();
Transition tt = new Transition() {
{
setCycleDuration(javafx.util.Duration.millis(d.toMillis()));
}
@Override
protected void interpolate(double frac) {
r.mouseMoveTo((int) (fromX + dx * frac), (int) (fromY + dy * frac));
}
};
tt.setOnFinished(e -> b.release(null));
tt.play();
r.block(b);
r.release(MouseButton.PRIMARY);
return r;
};
}
示例3: by
import javafx.animation.Transition; //导入方法依赖的package包/类
/**
* Create operation who moves the cursor from the current mouse position by the
* provided delta in the provided time
*
* @param d
* duration it takes move the delta
*
* @param dx
* the x delta
* @param dy
* the y delta
* @return operation
*/
public static Operation by(Duration d, double dx, double dy) {
return (r) -> {
BlockCondition<Void> b = new BlockCondition<>();
int mouseX = r.mouseX();
int mouseY = r.mouseY();
Transition tt = new Transition() {
{
setCycleDuration(javafx.util.Duration.millis(d.toMillis()));
}
@Override
protected void interpolate(double frac) {
r.mouseMoveTo((int) (mouseX + dx * frac), (int) (mouseY + dy * frac));
}
};
tt.setOnFinished(e -> b.release(null));
tt.play();
r.block(b);
return r;
};
}
示例4: to
import javafx.animation.Transition; //导入方法依赖的package包/类
/**
* Move the cursor to the x/y position on the screen
*
* @param d
* the duration it takes to reach the provided position
*
* @param x
* the absolute x coordinate on the screen
* @param y
* the absolute y coordinate on the screen
* @return operation
*/
public static Operation to(Duration d, double x, double y) {
return (r) -> {
BlockCondition<Void> b = new BlockCondition<>();
int mouseX = r.mouseX();
int mouseY = r.mouseY();
double dx = x - mouseX;
double dy = y - mouseY;
Transition tt = new Transition() {
{
setCycleDuration(javafx.util.Duration.millis(d.toMillis()));
}
@Override
protected void interpolate(double frac) {
r.mouseMoveTo((int) (mouseX + dx * frac), (int) (mouseY + dy * frac));
}
};
tt.setOnFinished(e -> b.release(null));
tt.play();
r.block(b);
return r;
};
}
示例5: displayWinningScreen
import javafx.animation.Transition; //导入方法依赖的package包/类
private void displayWinningScreen()
{
final int maxSize = 100;
scene.lookup("#endGameScreen").setStyle("visibility: visible");
displayOverlay();
Label endGameText = (Label)scene.lookup("#endGameText");
endGameText.setText("You Win!");
endGameText.getStyleClass().add("winningLabel");
endGameText.setStyle("visibility: visible");
Transition fontIncrease = new Transition() {
{
setCycleDuration(Duration.millis(1000));
}
@Override
protected void interpolate(double frac) {
endGameText.setStyle("-fx-font-size: " + Math.pow(frac, 3) * maxSize + "px");
}
};
fontIncrease.setOnFinished(event -> scene.lookup("#endGameButtons").setStyle("visibility: visible"));
fontIncrease.play();
}
示例6: MulticastEdgeRenderer
import javafx.animation.Transition; //导入方法依赖的package包/类
public MulticastEdgeRenderer() {
circle.setFill(Color.WHITE);
circle.setVisible(false);
animator = new Transition() {
{
setCycleDuration(Duration.millis(animationTime));
}
@Override
protected void interpolate(double frac) {
circle.setRadius(frac * 1000);
circle.setOpacity(1 - frac);
}
};
animator.setCycleCount(2);
animator.setOnFinished(e -> {
circle.setVisible(false);
});
}
示例7: doStep
import javafx.animation.Transition; //导入方法依赖的package包/类
@Override
public void doStep(final MachineContext context) {
WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");
ImageMosaicDataProvider dataProvider = context.getDataProvider(ImageMosaicDataProvider.class);
pane = wordleSkin.getPane();
if (dataProvider.getImages().size() < 35) {
context.proceed();
} else {
Transition createMosaicTransition = createMosaicTransition(dataProvider.getImages());
createMosaicTransition.setOnFinished((ActionEvent event) -> {
executeAnimations(context);
});
createMosaicTransition.play();
}
}
示例8: play
import javafx.animation.Transition; //导入方法依赖的package包/类
public void play(Transition transition)
{
Consumer<CountDownLatch> action = new Consumer<CountDownLatch>()
{
@Override
public void accept(CountDownLatch latch)
{
transition.setOnFinished((event) -> latch.countDown());
transition.play();
}
};
actLater(action);
}