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


Java Transition类代码示例

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


Transition类属于javafx.animation包,在下文中一共展示了Transition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
	};
}
 
开发者ID:BestSolution-at,项目名称:FX-Test,代码行数:40,代码来源:Drag.java

示例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;
	};
}
 
开发者ID:BestSolution-at,项目名称:FX-Test,代码行数:39,代码来源:Drag.java

示例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;
	};
}
 
开发者ID:BestSolution-at,项目名称:FX-Test,代码行数:35,代码来源:Move.java

示例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;
	};
}
 
开发者ID:BestSolution-at,项目名称:FX-Test,代码行数:36,代码来源:Move.java

示例5: createAnimation

import javafx.animation.Transition; //导入依赖的package包/类
private Transition createAnimation(Consumer<Double> fractionConsumer) {
    Transition transition = new Transition() {

        {
            setCycleDuration(animationDuration);
        }

        @Override
        protected void interpolate(double frac) {
            fractionConsumer.accept(frac);


        }
    };
    return transition;
}
 
开发者ID:hendrikebbers,项目名称:ExtremeGuiMakeover,代码行数:17,代码来源:AnimatedIcon.java

示例6: collapseMessagesIfNotCollapsed

import javafx.animation.Transition; //导入依赖的package包/类
public void collapseMessagesIfNotCollapsed() {
    final Transition collapse = new Transition() {
        double height = tabPaneContainer.getMaxHeight();

        {
            setInterpolator(Interpolator.SPLINE(0.645, 0.045, 0.355, 1));
            setCycleDuration(Duration.millis(200));
        }

        @Override
        protected void interpolate(final double frac) {
            tabPaneContainer.setMaxHeight(((height - 35) * (1 - frac)) + 35);
        }
    };

    if (tabPaneContainer.getMaxHeight() > 35) {
        collapse.play();
    }
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:20,代码来源:HUPPAALController.java

示例7: collapseMessagesClicked

import javafx.animation.Transition; //导入依赖的package包/类
@FXML
public void collapseMessagesClicked() {
    final Transition collapse = new Transition() {
        double height = tabPaneContainer.getMaxHeight();

        {
            setInterpolator(Interpolator.SPLINE(0.645, 0.045, 0.355, 1));
            setCycleDuration(Duration.millis(200));
        }

        @Override
        protected void interpolate(final double frac) {
            tabPaneContainer.setMaxHeight(((height - 35) * (1 - frac)) + 35);
        }
    };

    if (tabPaneContainer.getMaxHeight() > 35) {
        collapse.play();
    } else {
        expandMessagesContainer.play();
    }
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:23,代码来源:HUPPAALController.java

示例8: shirnkDetailsAction

import javafx.animation.Transition; //导入依赖的package包/类
@FXML
private void shirnkDetailsAction(ActionEvent event)
{
    if ("Cancel".equals(StudentDetailController.editCancelButton.getText()))
    {
        StudentDetailController.editCancelButtonAction(event);
    }

    final Animation animation = new Transition()
    {
        
        {
            setCycleDuration(Duration.millis(800));
        }

        @Override
        protected void interpolate(double frac)
        {
            SplitPaneMain.setDividerPosition(0, SplitPaneMain.getDividerPositions()[0]-frac);
        }
    };
    animation.play();
}
 
开发者ID:pranavjindal999,项目名称:Hostel-Management-System,代码行数:24,代码来源:MainProgramSceneController.java

示例9: 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();
}
 
开发者ID:YorkCS2016,项目名称:Antipleurdawn,代码行数:26,代码来源:BoardHandler.java

示例10: BasicEdgeRenderer

import javafx.animation.Transition; //导入依赖的package包/类
public BasicEdgeRenderer() {

       // line.setStroke(colorUnpicked);
        line.strokeProperty().bind(arrowStrokePaintProperty);
        arrowShape.fillProperty().bind(arrowHeadFillProperty);

        //animator = new StrokeTransition(Duration.millis(animationTime), arrowStrokePaintProperty, Color.WHITE);

        animator = new Transition() {
            {
                setCycleDuration(Duration.millis(animationTime));
            }
            protected void interpolate(double frac) {

                arrowStrokePaintProperty.set(currentEdgeStrokePaint.interpolate(currentAnimationEndColor, frac));
                arrowHeadFillProperty.set(currentArrowFill.interpolate(currentAnimationEndColor, frac));
            }
        };
        animator.setCycleCount(2);
        animator.setAutoReverse(true);
    }
 
开发者ID:truffle-hog,项目名称:truffle-hog,代码行数:22,代码来源:BasicEdgeRenderer.java

示例11: 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);
        });
    }
 
开发者ID:truffle-hog,项目名称:truffle-hog,代码行数:27,代码来源:MulticastEdgeRenderer.java

示例12: stepFinished

import javafx.animation.Transition; //导入依赖的package包/类
public void stepFinished()
{
	animator = new Transition()
	{
		{
			setCycleDuration(Duration.INDEFINITE);
		}

		@Override
		protected void interpolate(double frac)
		{
			if (isDone.get())
			{
				finishAndDie();
			}
		}

	};
	animator.play();
}
 
开发者ID:GeePawHill,项目名称:contentment,代码行数:21,代码来源:BeatWaiter.java

示例13: doStep

import javafx.animation.Transition; //导入依赖的package包/类
@Override
public void doStep(final MachineContext context) {
    WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");

    List<Transition> fadeOutTransitions = new ArrayList<>();

    Duration defaultDuration = Duration.seconds(1.5);

    // kill the remaining words from the cloud
    wordleSkin.word2TextMap.entrySet().forEach(entry -> {
        Text textNode = entry.getValue();
        FadeTransition ft = new FadeTransition(defaultDuration, textNode);
        ft.setToValue(0);
        ft.setOnFinished((event) -> {
            wordleSkin.getPane().getChildren().remove(textNode);
        });
        fadeOutTransitions.add(ft);
    });
    wordleSkin.word2TextMap.clear();

    ParallelTransition fadeLOuts = new ParallelTransition();

    fadeLOuts.getChildren().addAll(fadeOutTransitions);
    fadeLOuts.setOnFinished(e -> context.proceed());
    fadeLOuts.play();
}
 
开发者ID:TweetWallFX,项目名称:TweetwallFX,代码行数:27,代码来源:CloudFadeOutStep.java

示例14: 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();
    }
}
 
开发者ID:TweetWallFX,项目名称:TweetwallFX,代码行数:17,代码来源:ImageMosaicStep.java

示例15: ExceptionWitnessResponderButton

import javafx.animation.Transition; //导入依赖的package包/类
/**
 * @param origin The same origin that is passed to the
 * {@link edu.wpi.grip.core.util.ExceptionWitness}
 */
@Inject
ExceptionWitnessResponderButton(@Assisted Object origin, @Assisted String popOverTitle) {
  super();

  this.origin = checkNotNull(origin, "The origin can not be null");
  this.popOverTitle = checkNotNull(popOverTitle, "The pop over title can not be null");
  this.tooltip = new Tooltip();
  this.getStyleClass().add(STYLE_CLASS);

  final ImageView icon = new ImageView("/edu/wpi/grip/ui/icons/warning.png");

  setOnMouseClicked(event -> getPopover().show(this));
  setVisible(false);
  setContentDisplay(ContentDisplay.GRAPHIC_ONLY);
  setGraphic(icon);
  icon.setFitWidth(DPIUtility.SMALL_ICON_SIZE);
  icon.setFitHeight(DPIUtility.SMALL_ICON_SIZE);

  FadeTransition ft = new FadeTransition(Duration.millis(750), icon);
  ft.setToValue(0.1);
  ft.setCycleCount(Transition.INDEFINITE);
  ft.setAutoReverse(true);
  ft.play();
}
 
开发者ID:WPIRoboticsProjects,项目名称:GRIP,代码行数:29,代码来源:ExceptionWitnessResponderButton.java


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