本文整理汇总了Java中javafx.animation.PathTransition.OrientationType类的典型用法代码示例。如果您正苦于以下问题:Java OrientationType类的具体用法?Java OrientationType怎么用?Java OrientationType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OrientationType类属于javafx.animation.PathTransition包,在下文中一共展示了OrientationType类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyTransition
import javafx.animation.PathTransition.OrientationType; //导入依赖的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);
}
示例2: drawNode
import javafx.animation.PathTransition.OrientationType; //导入依赖的package包/类
@Override
public Node drawNode() {
currentTestNode = this;
PathTransition pathTransition = new PathTransition();
Pane p = pre(pathTransition);
SVGPath path = new SVGPath();
path.setContent("M40,60 C42,148 144,30 25,32");
path.setStrokeWidth(2);
path.setStroke(Color.RED);
p.getChildren().add(path);
path.setFill(Color.TRANSPARENT);
// pathTransition.setDuration(Duration.valueOf(typicalDuration));
pathTransition.setDuration(new Duration(typicalDuration));
pathTransition.setNode(circle);
circle.setRotate(30);
//pathTransition.setPath(AnimationPath.createFromPath(path));
pathTransition.setPath(path);
pathTransition.setOrientation(OrientationType.NONE);
timeline.setCycleCount(3);
timeline.setAutoReverse(true);
return p;
}
示例3: generatePathTransition
import javafx.animation.PathTransition.OrientationType; //导入依赖的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;
}
示例4: init
import javafx.animation.PathTransition.OrientationType; //导入依赖的package包/类
private void init(Stage primaryStage) {
Group root = new Group();
primaryStage.setResizable(false);
primaryStage.setScene(new Scene(root, 400,260));
Rectangle rect = new Rectangle (0, 0, 40, 40);
rect.setArcHeight(10);
rect.setArcWidth(10);
rect.setFill(Color.ORANGE);
root.getChildren().add(rect);
Path path = PathBuilder.create()
.elements(
new MoveTo(20,20),
new CubicCurveTo(380, 0, 380, 120, 200, 120),
new CubicCurveTo(0, 120, 0, 240, 380, 240)
)
.build();
path.setStroke(Color.DODGERBLUE);
path.getStrokeDashArray().setAll(5d,5d);
root.getChildren().add(path);
pathTransition = PathTransitionBuilder.create()
.duration(Duration.seconds(4))
.path(path)
.node(rect)
.orientation(OrientationType.ORTHOGONAL_TO_TANGENT)
.cycleCount(Timeline.INDEFINITE)
.autoReverse(true)
.build();
}
示例5: PathTransitionSample
import javafx.animation.PathTransition.OrientationType; //导入依赖的package包/类
public PathTransitionSample() {
super(400,260);
Rectangle rect = new Rectangle (0, 0, 40, 40);
rect.setArcHeight(10);
rect.setArcWidth(10);
rect.setFill(Color.ORANGE);
getChildren().add(rect);
Path path = PathBuilder.create()
.elements(
new MoveTo(20,20),
new CubicCurveTo(380, 0, 380, 120, 200, 120),
new CubicCurveTo(0, 120, 0, 240, 380, 240)
)
.build();
path.setStroke(Color.DODGERBLUE);
path.getStrokeDashArray().setAll(5d,5d);
getChildren().add(path);
pathTransition = PathTransitionBuilder.create()
.duration(Duration.seconds(4))
.path(path)
.node(rect)
.orientation(OrientationType.ORTHOGONAL_TO_TANGENT)
.cycleCount(Timeline.INDEFINITE)
.autoReverse(true)
.build();
}
示例6: applyAnimation
import javafx.animation.PathTransition.OrientationType; //导入依赖的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();
}