Search in sources :

Example 6 with PauseTransition

use of javafx.animation.PauseTransition in project fxexperience2 by EricCanull.

the class DemoController method bringBackAfter.

private void bringBackAfter() {
    PauseTransition pauseTransition = new PauseTransition();
    pauseTransition.setDuration(Duration.seconds(1.5));
    pauseTransition.play();
    pauseTransition.setOnFinished((ActionEvent t) -> {
        btn.setOpacity(1);
        btn.autosize();
    });
}
Also used : ActionEvent(javafx.event.ActionEvent) PauseTransition(javafx.animation.PauseTransition)

Example 7 with PauseTransition

use of javafx.animation.PauseTransition in project fxexperience2 by EricCanull.

the class AnimationController method bringBackAfter.

private void bringBackAfter() {
    PauseTransition pauseTransition = new PauseTransition();
    pauseTransition.setDuration(Duration.seconds(1.5));
    pauseTransition.play();
    pauseTransition.setOnFinished((ActionEvent t) -> {
        btn.setOpacity(1);
        btn.autosize();
    });
}
Also used : ActionEvent(javafx.event.ActionEvent) PauseTransition(javafx.animation.PauseTransition)

Example 8 with PauseTransition

use of javafx.animation.PauseTransition in project Board-Instrumentation-Framework by intel.

the class GaugeSkin method fadeBackToInteractive.

private void fadeBackToInteractive() {
    FadeTransition fadeUnitOut = new FadeTransition(Duration.millis(425), unitText);
    fadeUnitOut.setFromValue(1.0);
    fadeUnitOut.setToValue(0.0);
    FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), valueText);
    fadeValueOut.setFromValue(1.0);
    fadeValueOut.setToValue(0.0);
    PauseTransition pause = new PauseTransition(Duration.millis(50));
    FadeTransition fadeUnitIn = new FadeTransition(Duration.millis(425), unitText);
    fadeUnitIn.setFromValue(0.0);
    fadeUnitIn.setToValue(1.0);
    FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), valueText);
    fadeValueIn.setFromValue(0.0);
    fadeValueIn.setToValue(1.0);
    ParallelTransition parallelIn = new ParallelTransition(fadeUnitIn, fadeValueIn);
    ParallelTransition parallelOut = new ParallelTransition(fadeUnitOut, fadeValueOut);
    parallelOut.setOnFinished(event -> {
        unitText.setText("Interactive");
        valueText.setText("");
        resizeText();
    });
    SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
    sequence.play();
}
Also used : SequentialTransition(javafx.animation.SequentialTransition) FadeTransition(javafx.animation.FadeTransition) PauseTransition(javafx.animation.PauseTransition) ParallelTransition(javafx.animation.ParallelTransition)

Example 9 with PauseTransition

use of javafx.animation.PauseTransition in project FXyzLib by Birdasaur.

the class SimpleRayTest method animateRayTo.

/**
 *  Creates and launches a custom Transition animation
 *
 * @param r The Ray that holds the info
 * @param tx to x
 * @param ty to y
 * @param tz to z
 * @param dps distance per step to move ray
 * @param time length of animation
 */
private void animateRayTo(final Ray r, final Sphere target, final Duration time) {
    final Transition t = new Transition() {

        protected Ray ray;

        protected Sphere s;

        protected double dist;

        {
            this.ray = r;
            this.s = new Sphere(5);
            s.setTranslateX((ray.getOrigin()).getX());
            s.setTranslateY((ray.getOrigin()).getY());
            s.setTranslateZ((ray.getOrigin()).getZ());
            s.setMaterial(highlight);
            rayLight.getScope().add(s);
            this.dist = ray.getOrigin().distance(Point3D.ZERO.add(target.getTranslateX(), target.getTranslateY(), target.getTranslateZ()));
            setCycleDuration(time);
            this.setInterpolator(Interpolator.LINEAR);
            this.setOnFinished(e -> {
                if (target.getBoundsInParent().contains(ray.getPosition())) {
                    target.setMaterial(highlight);
                    // PauseTransition for delay
                    PauseTransition t = new PauseTransition(Duration.millis(750));
                    t.setOnFinished(pe -> {
                        reset();
                        root.getChildren().removeAll(s);
                        s = null;
                    });
                    t.playFromStart();
                }
            });
            root.getChildren().add(s);
        }

        @Override
        protected void interpolate(double frac) {
            // frac-> 0.0 - 1.0
            // project ray
            ray.project(dist * frac);
            // set the sphere to ray position
            s.setTranslateX(ray.getPosition().getX());
            s.setTranslateY(ray.getPosition().getY());
            s.setTranslateZ(ray.getPosition().getZ());
        }
    };
    t.playFromStart();
}
Also used : Sphere(javafx.scene.shape.Sphere) Transition(javafx.animation.Transition) PauseTransition(javafx.animation.PauseTransition) PauseTransition(javafx.animation.PauseTransition) Ray(org.fxyz.geometry.Ray)

Example 10 with PauseTransition

use of javafx.animation.PauseTransition in project tilesfx by HanSolo.

the class SmoothAreaChartTileSkin method initGraphics.

// ******************** Initialization ************************************
@Override
protected void initGraphics() {
    super.initGraphics();
    chartEventListener = e -> handleData();
    chartDataListener = c -> {
        while (c.next()) {
            if (c.wasAdded()) {
                c.getAddedSubList().forEach(addedItem -> addedItem.addChartDataEventListener(chartEventListener));
            } else if (c.wasRemoved()) {
                c.getRemoved().forEach(removedItem -> removedItem.removeChartDataEventListener(chartEventListener));
            }
        }
        handleData();
    };
    clickHandler = e -> select(e);
    endOfTransformationHandler = e -> selectorTooltip.hide();
    smoothing = tile.isSmoothing();
    titleText = new Text();
    titleText.setFill(tile.getTitleColor());
    Helper.enableNode(titleText, !tile.getTitle().isEmpty());
    fillClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT);
    strokeClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT);
    points = new ArrayList<>();
    fillPath = new Path();
    fillPath.setStroke(null);
    fillPath.setClip(fillClip);
    strokePath = new Path();
    strokePath.setFill(null);
    strokePath.setStroke(tile.getBarColor());
    strokePath.setClip(strokeClip);
    strokePath.setMouseTransparent(true);
    Helper.enableNode(fillPath, ChartType.AREA == tile.getChartType());
    canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
    canvas.setMouseTransparent(true);
    ctx = canvas.getGraphicsContext2D();
    dataPointsVisible = tile.getDataPointsVisible();
    valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100)));
    valueText.setFill(tile.getValueColor());
    valueText.setTextOrigin(VPos.BASELINE);
    Helper.enableNode(valueText, tile.isValueVisible());
    unitText = new Text(" " + tile.getUnit());
    unitText.setFill(tile.getUnitColor());
    unitText.setTextOrigin(VPos.BASELINE);
    Helper.enableNode(unitText, !tile.getUnit().isEmpty());
    valueUnitFlow = new TextFlow(valueText, unitText);
    valueUnitFlow.setTextAlignment(TextAlignment.RIGHT);
    selector = new Circle();
    selectorTooltip = new Tooltip("");
    selectorTooltip.setWidth(60);
    selectorTooltip.setHeight(48);
    Tooltip.install(selector, selectorTooltip);
    FadeTransition fadeIn = new FadeTransition(Duration.millis(100), selector);
    fadeIn.setFromValue(0);
    fadeIn.setToValue(1);
    FadeTransition fadeOut = new FadeTransition(Duration.millis(100), selector);
    fadeOut.setFromValue(1);
    fadeOut.setToValue(0);
    fadeInFadeOut = new SequentialTransition(fadeIn, new PauseTransition(Duration.millis(3000)), fadeOut);
    handleData();
    getPane().getChildren().addAll(titleText, fillPath, strokePath, canvas, valueUnitFlow, selector);
}
Also used : EventHandler(javafx.event.EventHandler) Path(javafx.scene.shape.Path) ClosePath(javafx.scene.shape.ClosePath) Fonts(eu.hansolo.tilesfx.fonts.Fonts) MouseEvent(javafx.scene.input.MouseEvent) CycleMethod(javafx.scene.paint.CycleMethod) LineTo(javafx.scene.shape.LineTo) ChartDataEventListener(eu.hansolo.tilesfx.events.ChartDataEventListener) EventType(eu.hansolo.tilesfx.events.TileEvent.EventType) LinearGradient(javafx.scene.paint.LinearGradient) TextFlow(javafx.scene.text.TextFlow) ArrayList(java.util.ArrayList) ChartData(eu.hansolo.tilesfx.chart.ChartData) FadeTransition(javafx.animation.FadeTransition) Helper(eu.hansolo.tilesfx.tools.Helper) ListChangeListener(javafx.collections.ListChangeListener) VPos(javafx.geometry.VPos) MoveTo(javafx.scene.shape.MoveTo) Point2D(javafx.geometry.Point2D) TextAlignment(javafx.scene.text.TextAlignment) Circle(javafx.scene.shape.Circle) Tooltip(javafx.scene.control.Tooltip) Tile(eu.hansolo.tilesfx.Tile) Color(javafx.scene.paint.Color) ChartType(eu.hansolo.tilesfx.Tile.ChartType) Stop(javafx.scene.paint.Stop) GraphicsContext(javafx.scene.canvas.GraphicsContext) Font(javafx.scene.text.Font) Canvas(javafx.scene.canvas.Canvas) PathElement(javafx.scene.shape.PathElement) Rectangle(javafx.scene.shape.Rectangle) Text(javafx.scene.text.Text) ActionEvent(javafx.event.ActionEvent) Duration(javafx.util.Duration) List(java.util.List) PauseTransition(javafx.animation.PauseTransition) TileEvent(eu.hansolo.tilesfx.events.TileEvent) SequentialTransition(javafx.animation.SequentialTransition) Optional(java.util.Optional) Point(eu.hansolo.tilesfx.tools.Point) Comparator(java.util.Comparator) Path(javafx.scene.shape.Path) ClosePath(javafx.scene.shape.ClosePath) Circle(javafx.scene.shape.Circle) SequentialTransition(javafx.animation.SequentialTransition) FadeTransition(javafx.animation.FadeTransition) Canvas(javafx.scene.canvas.Canvas) Tooltip(javafx.scene.control.Tooltip) Rectangle(javafx.scene.shape.Rectangle) Text(javafx.scene.text.Text) TextFlow(javafx.scene.text.TextFlow) PauseTransition(javafx.animation.PauseTransition)

Aggregations

PauseTransition (javafx.animation.PauseTransition)17 MouseEvent (javafx.scene.input.MouseEvent)7 SequentialTransition (javafx.animation.SequentialTransition)6 EventHandler (javafx.event.EventHandler)6 Duration (javafx.util.Duration)6 ArrayList (java.util.ArrayList)5 List (java.util.List)5 FadeTransition (javafx.animation.FadeTransition)5 ActionEvent (javafx.event.ActionEvent)5 Node (javafx.scene.Node)5 Color (javafx.scene.paint.Color)5 Locale (java.util.Locale)4 ParallelTransition (javafx.animation.ParallelTransition)4 Event (javafx.event.Event)4 EventType (javafx.event.EventType)4 Background (javafx.scene.layout.Background)4 BackgroundFill (javafx.scene.layout.BackgroundFill)4 Region (javafx.scene.layout.Region)4 Paint (javafx.scene.paint.Paint)4 UnmodifiableListSet (com.sun.javafx.collections.UnmodifiableListSet)3