當前位置: 首頁>>代碼示例>>Java>>正文


Java Transition.play方法代碼示例

本文整理匯總了Java中javafx.animation.Transition.play方法的典型用法代碼示例。如果您正苦於以下問題:Java Transition.play方法的具體用法?Java Transition.play怎麽用?Java Transition.play使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.animation.Transition的用法示例。


在下文中一共展示了Transition.play方法的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: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: positionThumb

import javafx.animation.Transition; //導入方法依賴的package包/類
/**
 * Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed.
 */
void positionThumb(final boolean animate) {
    Slider s = getSkinnable();
    if (s.getValue() > s.getMax()) return;// this can happen if we are bound to something
    boolean horizontal = s.getOrientation() == Orientation.HORIZONTAL;
    final double endX = (horizontal) ? trackStart + (((trackLength * ((s.getValue() - s.getMin()) /
            (s.getMax() - s.getMin()))) - thumbWidth / 2)) : thumbLeft;
    final double endY = (horizontal) ? thumbTop :
            snappedTopInset() + trackLength - (trackLength * ((s.getValue() - s.getMin()) /
                    (s.getMax() - s.getMin()))); //  - thumbHeight/2

    if (animate) {
        // lets animate the thumb transition
        final double startX = thumb.getLayoutX();
        final double startY = thumb.getLayoutY();
        Transition transition = new Transition() {
            {
                setCycleDuration(Duration.millis(200));
            }

            @Override
            protected void interpolate(double frac) {
                if (!Double.isNaN(startX)) {
                    thumb.setLayoutX(startX + frac * (endX - startX));
                }
                if (!Double.isNaN(startY)) {
                    thumb.setLayoutY(startY + frac * (endY - startY));
                }
            }
        };
        transition.play();
    } else {
        thumb.setLayoutX(endX);
        thumb.setLayoutY(endY);
    }
}
 
開發者ID:thane98,項目名稱:FEFEditor,代碼行數:39,代碼來源:FilledSliderSkin.java

示例11: positionThumb

import javafx.animation.Transition; //導入方法依賴的package包/類
/**
 * Called when ever either min, max or value changes, so thumb's layoutX, Y is recomputed.
 */
void positionThumb(final boolean animate) {
    Slider s = getSkinnable();
    if (s.getValue() > s.getMax()) return;// this can happen if we are bound to something
    boolean horizontal = s.getOrientation() == Orientation.HORIZONTAL;
    final double endX = (horizontal) ? trackStart + (((trackLength * ((s.getValue() - s.getMin()) /
            (s.getMax() - s.getMin()))) - thumbWidth/2)) : thumbLeft;
    final double endY = (horizontal) ? thumbTop :
            snappedTopInset() + trackLength - (trackLength * ((s.getValue() - s.getMin()) /
                    (s.getMax() - s.getMin()))); //  - thumbHeight/2

    if (animate) {
        // lets animate the thumb transition
        final double startX = thumb.getLayoutX();
        final double startY = thumb.getLayoutY();
        Transition transition = new Transition() {
            {
                setCycleDuration(Duration.millis(200));
            }

            @Override protected void interpolate(double frac) {
                if (!Double.isNaN(startX)) {
                    thumb.setLayoutX(startX + frac * (endX - startX));
                }
                if (!Double.isNaN(startY)) {
                    thumb.setLayoutY(startY + frac * (endY - startY));
                }
            }
        };
        transition.play();
    } else {
        thumb.setLayoutX(endX);
        thumb.setLayoutY(endY);
    }
}
 
開發者ID:thane98,項目名稱:3DSFE-Randomizer,代碼行數:38,代碼來源:FilledSliderSkin.java

示例12: toggleDeclaration

import javafx.animation.Transition; //導入方法依賴的package包/類
public void toggleDeclaration(final MouseEvent mouseEvent) {
    final Circle circle = new Circle(0);
    circle.setCenterX(component.get().getWidth() - (toggleDeclarationButton.getWidth() - mouseEvent.getX()));
    circle.setCenterY(-1 * mouseEvent.getY());

    final ObjectProperty<Node> clip = new SimpleObjectProperty<>(circle);
    declaration.clipProperty().bind(clip);

    final Transition rippleEffect = new Transition() {
        private final double maxRadius = Math.sqrt(Math.pow(getComponent().getWidth(), 2) + Math.pow(getComponent().getHeight(), 2));

        {
            setCycleDuration(Duration.millis(500));
        }

        protected void interpolate(final double fraction) {
            if (getComponent().isDeclarationOpen()) {
                circle.setRadius(fraction * maxRadius);
            } else {
                circle.setRadius(maxRadius - fraction * maxRadius);
            }
            clip.set(circle);
        }
    };

    final Interpolator interpolator = Interpolator.SPLINE(0.785, 0.135, 0.15, 0.86);
    rippleEffect.setInterpolator(interpolator);

    rippleEffect.play();
    getComponent().declarationOpenProperty().set(!getComponent().isDeclarationOpen());
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:32,代碼來源:ComponentController.java

示例13: playColor

import javafx.animation.Transition; //導入方法依賴的package包/類
/**
 * changes color to white and fades it back to ordinary color
 */
protected void playColor()
{
	if (on == NotePlayState.OFF)
		return;

	if (on == NotePlayState.ON_TEMP)
		on = NotePlayState.OFF;

	Color stroke = (Color)getStroke();
	ft = new Transition()
	{
		{
			setCycleDuration(TRANSITION_DURATION);
		}
		@Override
		protected void interpolate(double frac)
		{
			if (on != NotePlayState.OFF)
			{
				setFill(FILL_PLAY.interpolate(fillOn, frac));
				setStroke(stroke.interpolate(on == NotePlayState.ON_PERMA ? PERMA_STROKE : fillOn.invert(), frac));
			}
			else
			{
				setFill(FILL_PLAY.interpolate(FILL_OFF, frac));
				setStroke(stroke.interpolate(PERMA_STROKE, frac));
			}
		}
	};
	ft.play();

	ClearComposer.cc.updateNotes();
}
 
開發者ID:creativitRy,項目名稱:ClearComposer,代碼行數:37,代碼來源:GraphicNote.java

示例14: 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);
	
}
 
開發者ID:GeePawHill,項目名稱:contentment,代碼行數:15,代碼來源:JavaFxRunner.java

示例15: explode

import javafx.animation.Transition; //導入方法依賴的package包/類
/**
 * Plays back all of the transitions for the individual particles and 
 * removes this instance of ParticleExplosion.
 * PreCondition: We have set up our ParticleExplosion with generated particles and this resides within a Pane.
 * PostCondition: The particles have been animated and this instance has been removed from the parent Pane.
 */
public void explode() {
    //Play the animations and destroy this instance of ParticleExplosion
    for (Transition transition : transitions) {
        transition.play();
    }
}
 
開發者ID:zx96,項目名稱:piupiu,代碼行數:13,代碼來源:ParticleExplosion.java


注:本文中的javafx.animation.Transition.play方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。