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


Java PathTransition类代码示例

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


PathTransition类属于javafx.animation包,在下文中一共展示了PathTransition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: animate

import javafx.animation.PathTransition; //导入依赖的package包/类
private void animate(Circle particle, Path path) {
    Random randGen = new Random();

    PathTransition pathTransition = new PathTransition(Duration.seconds(path.getElements().size() * (randGen.nextInt(30) + 30)), path, particle);
    pathTransition.setInterpolator(Interpolator.EASE_OUT);

    ScaleTransition scaleTransition = new ScaleTransition(Duration.seconds(3f), particle);
    scaleTransition.setToX(10f);
    scaleTransition.setToY(10f);
    scaleTransition.setInterpolator(Interpolator.EASE_OUT);

    FadeTransition fadeTransition = new FadeTransition(Duration.seconds(6f), particle);
    fadeTransition.setToValue(0.7);
    fadeTransition.setInterpolator(Interpolator.EASE_OUT);

    pathTransition.play();
    scaleTransition.play();
    fadeTransition.play();
}
 
开发者ID:Cldfire,项目名称:Forum-Notifier,代码行数:20,代码来源:ParticleAnimation.java

示例2: applyTransition

import javafx.animation.PathTransition; //导入依赖的package包/类
public void applyTransition(Node node) {
    PathTransition pathTransition = new PathTransition();
    timeline = pathTransition;

    path = (Path) drawPath(140.0, 140.0, 0);
    path.setStrokeWidth(2);
    path.setStroke(Color.RED);

    path.setFill(Color.TRANSPARENT);

    pathTransition.setDuration(Duration.millis(motionDuration));
    pathTransition.setNode(node);
    //pathTransition.setPath(AnimationPath.createFromPath(path));
    pathTransition.setPath(path);
    pathTransition.setOrientation(OrientationType.ORTHOGONAL_TO_TANGENT);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:17,代码来源:ContentMotion.java

示例3: reanimateData

import javafx.animation.PathTransition; //导入依赖的package包/类
/**
 * Reanimates the data, used when resizing occurs
 */
void reanimateData() {
	setUpAnimationPath();
	if (!animating)
		return;

	for(PathTransition p : transitions){
		p.stop();
		p.setPath(path);
		p.playFrom(new Duration(progressed));
	}

	synchronized (this) {
		progressed++;
	}
}
 
开发者ID:mbway,项目名称:Simulizer,代码行数:19,代码来源:Wire.java

示例4: generatePathTransition

import javafx.animation.PathTransition; //导入依赖的package包/类
/**
 * Generate the path transition.
 * 
 * @param shape Shape to travel along path.
 * @param path Path to be traveled upon.
 * @param duration Duration of single animation.
 * @param delay Delay before beginning first animation.
 * @param orientation Orientation of shape during animation.
 * @return PathTransition.
 */
private PathTransition generatePathTransition(
   final Shape shape, final Path path,
   final Duration duration, final Duration delay,
   final OrientationType orientation)
{
   final PathTransition pathTransition = new PathTransition();
   pathTransition.setDuration(duration);
   pathTransition.setDelay(delay);
   pathTransition.setPath(path);
   pathTransition.setNode(shape);
   pathTransition.setOrientation(orientation);
   pathTransition.setCycleCount(Timeline.INDEFINITE);
   pathTransition.setAutoReverse(true);
   return pathTransition;
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:26,代码来源:SlideDemo.java

示例5: movePawn

import javafx.animation.PathTransition; //导入依赖的package包/类
/**
 * Method to move a pawn along some rooms
 * @param role the role corresponding to the pawn
 * @param rooms the names of the rooms on the pawns way
 */
public void movePawn(Role role, String... rooms) {
    Pawn pawn = null;
    for (Pawn p : pawns) {
        if (p.getPlayer().getRole() == role) {
            pawn = p;
        }
    }
    if (pawn != null && rooms.length > 0) {
        PathTransition[] transitions = new PathTransition[rooms.length];
        int i = 0;
        for (String name : rooms) {
            transitions[i++] = movePawn(pawn, this.rooms.get(name));
        }
        for (i = 1; i < transitions.length; ++i) {
            final int j = i;
            transitions[i-1].setOnFinished(event -> transitions[j].play());
        }
        transitions[transitions.length-1].setOnFinished(event -> view.fireMovePawnFinished());
        transitions[0].play();
    }
}
 
开发者ID:MrFouss,项目名称:The-Projects,代码行数:27,代码来源:Board.java

示例6: moveToDeck

import javafx.animation.PathTransition; //导入依赖的package包/类
/**
 * Method to display the movement of a card to a Deck
 * @param card the card to move
 */
private PathTransition moveToDeck(Card card) {
    StackPane deck = ownerToDeck(card.getOwner());
    Path path = new Path(new MoveTo(card.localToParent(0,0).getX() + card.getWidth()/2, card.localToParent(0,0).getY() + card.getHeight()/2),
            new LineTo(deck.localToParent(deck.getWidth()/2.,deck.getHeight()/2.).getX(), deck.localToParent(deck.getWidth()/2.,deck.getHeight()/2.).getY()));

    boolean horizontal = card.getOwner() == Owner.PROJECT_DECK || card.getOwner() == Owner.PROJECT_DISCARD;

    card.toFront();
    if (horizontal) {
        RotateTransition rotateTransition = new RotateTransition(Duration.millis(500), card);
        rotateTransition.setByAngle(-90);
        rotateTransition.play();
    }

    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(500), card);
    scaleTransition.setToX(horizontal ? deck.getScaleY() : deck.getScaleX());
    scaleTransition.setToY(horizontal ? deck.getScaleX() : deck.getScaleY());
    scaleTransition.play();

    card.setClickable(false, view);

    return new PathTransition(Duration.seconds(.5),path,card);
}
 
开发者ID:MrFouss,项目名称:The-Projects,代码行数:28,代码来源:Board.java

示例7: animateCardMovement

import javafx.animation.PathTransition; //导入依赖的package包/类
/**
 * Animates card movements.
 *
 * @param card     The card view to animate.
 * @param sourceX  Source X coordinate of the card view.
 * @param sourceY  Source Y coordinate of the card view.
 * @param targetX  Destination X coordinate of the card view.
 * @param targetY  Destination Y coordinate of the card view.
 * @param duration The duration of the animation.
 * @param doAfter  The action to perform after the animation has been completed.
 */
private void animateCardMovement(
    CardView card, double sourceX, double sourceY,
    double targetX, double targetY, Duration duration,
    EventHandler<ActionEvent> doAfter) {

  Path path = new Path();
  path.getElements().add(new MoveToAbs(card, sourceX, sourceY));
  path.getElements().add(new LineToAbs(card, targetX, targetY));

  PathTransition pathTransition =
      new PathTransition(duration, path, card);
  pathTransition.setInterpolator(Interpolator.EASE_IN);
  pathTransition.setOnFinished(doAfter);

  Timeline blurReset = new Timeline();
  KeyValue bx = new KeyValue(card.getDropShadow().offsetXProperty(), 0, Interpolator.EASE_IN);
  KeyValue by = new KeyValue(card.getDropShadow().offsetYProperty(), 0, Interpolator.EASE_IN);
  KeyValue br = new KeyValue(card.getDropShadow().radiusProperty(), 2, Interpolator.EASE_IN);
  KeyFrame bKeyFrame = new KeyFrame(duration, bx, by, br);
  blurReset.getKeyFrames().add(bKeyFrame);

  ParallelTransition pt = new ParallelTransition(card, pathTransition, blurReset);
  pt.play();
}
 
开发者ID:ZoltanDalmadi,项目名称:JCardGamesFX,代码行数:36,代码来源:KlondikeMouseUtil.java

示例8: AnimationTile

import javafx.animation.PathTransition; //导入依赖的package包/类
public AnimationTile(Pane pane, TraducteurBoard trad){
    hex = new Hexagon(); 
    polygon = new Polygon();
    calculPolygon();        
    pathAnimation = new PathTransition();
    if(OptionManager.isAnimationsEnable())
        pathAnimation.setDuration(Duration.seconds(1));
    else
        pathAnimation.setDuration(Duration.seconds(0));
    pathAnimation.setNode(polygon);
    panCanvas = pane;
    traductor = trad;
}
 
开发者ID:Plinz,项目名称:Hive_Game,代码行数:14,代码来源:AnimationTile.java

示例9: slice

import javafx.animation.PathTransition; //导入依赖的package包/类
private static void slice(Node node, double layoutFromX, double layoutFromY, double layoutToX, double layoutToY,
                          double opacity, EventHandler<ActionEvent> handler) {
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(200), node);
    fadeTransition.setFromValue(opacity);
    fadeTransition.setToValue(1D - opacity);
    Path path = new Path();
    path.getElements().add(new MoveTo(node.getLayoutX() + layoutToX, node.getLayoutY() + layoutToY));
    node.setLayoutX(node.getLayoutX() + layoutFromX);
    node.setLayoutY(node.getLayoutY() + layoutFromY);
    PathTransition pathTransition = new PathTransition(Duration.millis(200), path, node);
    ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, pathTransition);
    parallelTransition.setOnFinished(handler);
    parallelTransition.play();
}
 
开发者ID:IzzelAliz,项目名称:LCL,代码行数:15,代码来源:SliceTransition.java

示例10: toMove

import javafx.animation.PathTransition; //导入依赖的package包/类
private void toMove(){
    for (Line line : curLines) {
        Circle circle = new Circle(line.getStartX(), line.getStartY(), 7, Color.ORANGE);

        Path curPath = new Path();
        curPath.getElements().add(new MoveTo(line.getStartX(),line.getStartY()));
        curPath.getElements().add(new CubicCurveTo(0.5 * (line.getStartX() + line.getEndX()),
                0.5 * (line.getEndY() + line.getStartY()), 0.3*line.getStartX()+0.7*line.getEndX(),
                0.3*line.getStartY()+0.7*line.getEndY(), line.getEndX(), line.getEndY()));

        PathTransition curPathTransition = new PathTransition();
        curPathTransition.setDuration(Duration.millis(line.getBaselineOffset() / (down_canvas.getPrefWidth() / 2) * 30000));
        curPathTransition.setPath(curPath);
        curPathTransition.setNode(circle);
        curPathTransition.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
        curPathTransition.setCycleCount(Timeline.INDEFINITE);
        curPathTransition.setAutoReverse(false);
        curPathTransition.play();

        down_canvas.getChildren().addAll(circle,curPath);
        if (curLines == downLines)
            downCircles.add(circle);
        else
            mergeCircles.add(circle);

    }
}
 
开发者ID:Luodian,项目名称:Higher-Cloud-Computing-Project,代码行数:28,代码来源:DownController.java

示例11: makeAnimation

import javafx.animation.PathTransition; //导入依赖的package包/类
private Animation makeAnimation (Node agent, int x, int y, int z) {
    // create something to follow
    Path path = new Path();
    path.getElements().addAll(new MoveTo(x, y), new VLineTo(z));
    // create an animation where the shape follows a path
    PathTransition pt = new PathTransition(Duration.millis(4000), path, agent);

    // put them together in order
    return new SequentialTransition(agent, pt);
}
 
开发者ID:LtubSalad,项目名称:voogasalad-ltub,代码行数:11,代码来源:LoaderTester.java

示例12: initUI

import javafx.animation.PathTransition; //导入依赖的package包/类
@Override
protected void initUI() {
    Text text = getUIFactory().newText("Level 1", Color.WHITE, 48);
    getGameScene().addUINode(text);

    QuadCurve curve = new QuadCurve(-100, 0, getWidth() / 2, getHeight(), getWidth() + 100, 0);

    PathTransition transition = new PathTransition(Duration.seconds(4), curve, text);
    transition.setOnFinished(e -> {
        getGameScene().removeUINode(text);
        getBallControl().release();
    });
    transition.play();
}
 
开发者ID:AlmasB,项目名称:FXGLGames,代码行数:15,代码来源:BreakoutApp.java

示例13: animateData

import javafx.animation.PathTransition; //导入依赖的package包/类
/**
 * Animates data along the wire
 * @param animTime The time for the animation to complete in
    */
public void animateData(double animTime) {
       final Wire self = this;
	Platform.runLater(() -> {
		animating = true;
		PathTransition pathTransition = new PathTransition();
		time = animTime;

		transitions.add(pathTransition);

		pathTransition.setDuration(Duration.millis(time));
		Circle data = new Circle(0, 0, 7.5);
		data.getStyleClass().addAll("cpu-data");
		pathTransition.setNode(data);
		pathTransition.setPath(path);
		pathTransition.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT);
		pathTransition.setCycleCount(1);
		pathTransition.setAutoReverse(false);

		data.setCache(true);

		toFront();

		getChildren().add(data);
		pathTransition.play();

		pathTransition.setOnFinished(event -> {
			getChildren().remove(data);
			transitions.remove(pathTransition);
		});

		synchronized (self) {
			progressed++;
		}
	});
}
 
开发者ID:mbway,项目名称:Simulizer,代码行数:40,代码来源:Wire.java

示例14: applyAnimation

import javafx.animation.PathTransition; //导入依赖的package包/类
/**
 * Apply animation.
 *  
 * @param group Group to which animation is to be applied.
 */
private void applyAnimation(final Group group)
{
   final Path path = generateCurvyPath();
   group.getChildren().add(path);
   final Shape rmoug = generateTitleText();
   group.getChildren().add(rmoug);
   final Shape td = generateDaysText();
   group.getChildren().add(td);
   final Shape denver = generateLocationText();
   group.getChildren().add(denver);
   final PathTransition rmougTransition =
      generatePathTransition(
         rmoug, path, Duration.seconds(8.0), Duration.seconds(0.5),
         OrientationType.NONE);
   final PathTransition tdTransition =
      generatePathTransition(
         td, path, Duration.seconds(5.5), Duration.seconds(0.1),
         OrientationType.NONE);
   final PathTransition denverTransition =
      generatePathTransition(
         denver, path, Duration.seconds(30), Duration.seconds(3),
         OrientationType.ORTHOGONAL_TO_TANGENT);
   final ParallelTransition parallelTransition =
      new ParallelTransition(rmougTransition, tdTransition, denverTransition);
   parallelTransition.play(); 
}
 
开发者ID:mars-sim,项目名称:mars-sim,代码行数:32,代码来源:SlideDemo.java

示例15: increase

import javafx.animation.PathTransition; //导入依赖的package包/类
/**
 * Method to increase of 1 unit the Outbreaks Gauge
 */
public void increase(View view) {
    if (lvl < 9) {
        double column1 = 42, column2 = column1 + 60;
        Path path = new Path(new MoveTo(lvl%2 == 0 ? column2 : column1, 50 + (lvl-1)*35), new LineTo(lvl%2 == 0 ? column1 : column2, 50 + lvl*35));
        PathTransition pathTransition = new PathTransition(Duration.millis(1000),path,actual);
        pathTransition.setOnFinished(event -> view.fireOutbreakFinished());
        pathTransition.play();
        lvl++;
    }

}
 
开发者ID:MrFouss,项目名称:The-Projects,代码行数:15,代码来源:OutbreaksGauge.java


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