本文整理汇总了Java中javafx.animation.RotateTransition.setInterpolator方法的典型用法代码示例。如果您正苦于以下问题:Java RotateTransition.setInterpolator方法的具体用法?Java RotateTransition.setInterpolator怎么用?Java RotateTransition.setInterpolator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.animation.RotateTransition
的用法示例。
在下文中一共展示了RotateTransition.setInterpolator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: close
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
public void close() {
if (State.CLOSED == getState()) return;
setState(State.CLOSED);
RotateTransition rotate = new RotateTransition();
rotate.setNode(cross);
rotate.setToAngle(0);
rotate.setDuration(Duration.millis(200));
rotate.setInterpolator(Interpolator.EASE_BOTH);
rotate.play();
closeTimeLines[closeTimeLines.length - 1].setOnFinished(actionEvent -> {
FadeTransition buttonFadeOut = new FadeTransition();
buttonFadeOut.setNode(mainMenuButton);
buttonFadeOut.setDuration(Duration.millis(100));
buttonFadeOut.setToValue(options.getButtonAlpha());
buttonFadeOut.play();
buttonFadeOut.setOnFinished(event -> {
if (options.isButtonHideOnClose()) hide();
fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_FINISHED));
});
});
for (int i = 0 ; i < closeTimeLines.length ; i++) {
closeTimeLines[i].play();
}
fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_STARTED));
}
示例2: createFlipEndTransition
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
/**
* Creates a {@link RotateTransition} that is the second/end part of a flip
* animation.
*
* @param pNode the {@link Node}.
* @param pOrientation the {@link Orientation} in which to rotate. Note that
* {@link Orientation#HORIZONTAL} means from right to left.
* @param pRightLeftTopDown {@code true} if the animation should be from
* right to left/top to down. {@code false} if it should be left
* to right/bottom to up.
* @return the created {@link RotateTransition}.
*/
public static RotateTransition createFlipEndTransition(Node pNode, Orientation pOrientation, boolean pRightLeftTopDown)
{
double startingAngle = calculateEdgeAngle(pNode, pOrientation);
RotateTransition endTransition = new RotateTransition(Duration.millis(466), pNode);
endTransition.setAxis(getAxis(pOrientation));
if (pRightLeftTopDown)
{
endTransition.setFromAngle(startingAngle + 180);
endTransition.setToAngle(360);
}
else
{
endTransition.setFromAngle(startingAngle);
endTransition.setToAngle(0);
}
endTransition.setInterpolator(Interpolator.EASE_OUT);
return endTransition;
}
示例3: createFlipStartTransition
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
/**
* Creates a {@link RotateTransition} that is the first/start part of a flip
* animation.
*
* @param pNode the {@link Node}.
* @param pOrientation the {@link Orientation} in which to rotate. Note that
* {@link Orientation#HORIZONTAL} means from right to left.
* @param pRightLeftTopDown {@code true} if the animation should be from
* right to left/top to down. {@code false} if it should be left
* to right/bottom to up.
* @return the created {@link RotateTransition}.
*/
public static RotateTransition createFlipStartTransition(Node pNode, Orientation pOrientation, boolean pRightLeftTopDown)
{
double endingAngle = calculateEdgeAngle(pNode, pOrientation);
RotateTransition transition = new RotateTransition(Duration.millis(466), pNode);
transition.setAxis(getAxis(pOrientation));
if (pRightLeftTopDown)
{
transition.setFromAngle(0);
transition.setToAngle(endingAngle);
}
else
{
transition.setFromAngle(360);
transition.setToAngle(endingAngle + 180);
}
transition.setInterpolator(Interpolator.EASE_IN);
return transition;
}
示例4: LoadingBar
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
public LoadingBar() {
Circle outer = new Circle(50);
outer.setFill(null);
outer.setStroke(Color.BLACK);
Circle inner = new Circle(5);
inner.setTranslateY(-50);
rt = new RotateTransition(Duration.seconds(2), this);
rt.setToAngle(360);
rt.setInterpolator(Interpolator.LINEAR);
rt.setCycleCount(RotateTransition.INDEFINITE);
getChildren().addAll(outer, inner);
setVisible(false);
}
示例5: LoadingCircle
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
public LoadingCircle() {
Circle circle = new Circle(20);
circle.setFill(null);
circle.setStroke(Color.WHITE);
circle.setStrokeWidth(2);
Rectangle rect = new Rectangle(20, 20);
Shape shape = Shape.subtract(circle, rect);
shape.setFill(Color.WHITE);
getChildren().add(shape);
animation = new RotateTransition(Duration.seconds(2.5), this);
animation.setByAngle(-360);
animation.setInterpolator(Interpolator.LINEAR);
animation.setCycleCount(Animation.INDEFINITE);
animation.play();
}
示例6: IconRotation
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
/**
* An animation which rotates the icon of a button.
*
* @param graphic The graphic on which the icon should be animated, must not be null.
*/
public IconRotation(Node graphic) {
rotateProperty = graphic.rotateProperty();
rotation = new RotateTransition(DURATION, graphic);
rotation.setInterpolator(EASE_BOTH);
rotation.setCycleCount(INDEFINITE);
rotation.setFromAngle(0);
rotation.setToAngle(360);
}
示例7: rotateAroundYAxis
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
private RotateTransition rotateAroundYAxis(Node node) {
RotateTransition rotate = new RotateTransition(
Duration.seconds(ROTATE_SECS),
node
);
rotate.setAxis(Rotate.Y_AXIS);
rotate.setFromAngle(360);
rotate.setToAngle(0);
rotate.setInterpolator(Interpolator.LINEAR);
rotate.setCycleCount(RotateTransition.INDEFINITE);
return rotate;
}
示例8: rotateGlobe
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
public void rotateGlobe() {
rt = new RotateTransition(Duration.seconds(OrbitInfo.SOLAR_DAY/500D), globe.getWorld());
//rt.setByAngle(360);
rt.setInterpolator(Interpolator.LINEAR);
rt.setCycleCount(Animation.INDEFINITE);
rt.setAxis(Rotate.Y_AXIS);
rt.setFromAngle(360);
rt.setToAngle(0);
rt.play();
}
示例9: initGraphics
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
private void initGraphics() {
setPickOnBounds(false);
cross = new Region();
cross.getStyleClass().add("cross");
cross.setMouseTransparent(true);
crossRotate = new RotateTransition(Duration.millis(200), cross);
crossRotate.setInterpolator(Interpolator.EASE_BOTH);
// Add all nodes
getChildren().addAll(cross);
}
示例10: selfRotation
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
private RotateTransition selfRotation() {
RotateTransition rotate = new RotateTransition(Duration.seconds(ROTATE_SECS), this);
rotate.setAxis(Rotate.Y_AXIS);
rotate.setFromAngle(clockRotate ? 0 : 360);
rotate.setToAngle(clockRotate ? 360 : 0);
rotate.setInterpolator(Interpolator.LINEAR);
rotate.setCycleCount(RotateTransition.INDEFINITE);
return rotate;
}
示例11: createRotateTransition
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
RotateTransition createRotateTransition(Duration duration, Node node, int startAngle) {
RotateTransition rt = new RotateTransition(duration, node);
rt.setFromAngle(startAngle);
rt.setByAngle(360);
rt.setCycleCount(Animation.INDEFINITE);
rt.setInterpolator(Interpolator.LINEAR);
return rt;
}
示例12: createRotateTransition
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
/**
* 360度回転を繰り返すアニメーションの設定。
*
* @param duration 1回転するのに要する時間
* @param node 回転するノード
* @param startAngle 回転開始角度
* @return 指定下パラメータで初期化したRotateTransitionインスタンス
*/
private RotateTransition createRotateTransition(Duration duration, Node node, double startAngle) {
RotateTransition rt = new RotateTransition(duration, node);
rt.setFromAngle(startAngle);
rt.setByAngle(360);
rt.setCycleCount(Animation.INDEFINITE);
rt.setInterpolator(Interpolator.LINEAR);
return rt;
}
示例13: start
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
@Override
public void start(Stage stage) throws Exception {
if (stage == null) {
return;
}
Rectangle clipRect1 = new Rectangle(-130, -130, 115, 115);
Rectangle clipRect2 = new Rectangle(15, -130, 115, 115);
Rectangle clipRect3 = new Rectangle(-130, 15, 115, 115);
Rectangle clipRect4 = new Rectangle(15, 15, 115, 115);
Group clip = new Group(clipRect1, clipRect2, clipRect3, clipRect4);
Circle spinnanCircle = new Circle(100);
spinnanCircle.setFill(null);
spinnanCircle.setStrokeWidth(30);
spinnanCircle.setStroke(LTTNG_PURPLE);
spinnanCircle.setClip(clip);
Circle magCircle = new Circle(60);
magCircle.setFill(null);
magCircle.setStrokeWidth(25);
magCircle.setStroke(LTTNG_LIGHT_BLUE);
Rectangle magHandle = new Rectangle(-12.5, 60, 25, 110);
magHandle.setFill(LTTNG_LIGHT_BLUE);
Group mag = new Group(magCircle, magHandle);
Group root = new Group(spinnanCircle, mag);
root.setRotate(30);
root.relocate(0, 0);
Pane pane = new Pane(root);
pane.setStyle(BACKGROUND_STYLE);
RotateTransition spinnan = new RotateTransition(Duration.seconds(4), spinnanCircle);
spinnan.setByAngle(360);
spinnan.setCycleCount(Animation.INDEFINITE);
spinnan.setInterpolator(Interpolator.LINEAR);
Scene scene = new Scene(pane);
stage.setScene(scene);
stage.show();
spinnan.play();
}
示例14: startButtonPressed
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
@FXML
private void startButtonPressed(ActionEvent event)
{
// transition that changes a shape's fill
FillTransition fillTransition =
new FillTransition(Duration.seconds(1));
fillTransition.setToValue(Color.CYAN);
fillTransition.setCycleCount(2);
// each even cycle plays transition in reverse to restore original
fillTransition.setAutoReverse(true);
// transition that changes a shape's stroke over time
StrokeTransition strokeTransition =
new StrokeTransition(Duration.seconds(1));
strokeTransition.setToValue(Color.BLUE);
strokeTransition.setCycleCount(2);
strokeTransition.setAutoReverse(true);
// parallelizes multiple transitions
ParallelTransition parallelTransition =
new ParallelTransition(fillTransition, strokeTransition);
// transition that changes a node's opacity over time
FadeTransition fadeTransition =
new FadeTransition(Duration.seconds(1));
fadeTransition.setFromValue(1.0); // opaque
fadeTransition.setToValue(0.0); // transparent
fadeTransition.setCycleCount(2);
fadeTransition.setAutoReverse(true);
// transition that rotates a node
RotateTransition rotateTransition =
new RotateTransition(Duration.seconds(1));
rotateTransition.setByAngle(360.0);
rotateTransition.setCycleCount(2);
rotateTransition.setInterpolator(Interpolator.EASE_BOTH);
rotateTransition.setAutoReverse(true);
// transition that moves a node along a Path
Path path = new Path(new MoveTo(45, 45), new LineTo(45, 0),
new LineTo(90, 0), new LineTo(90, 90), new LineTo(0, 90));
PathTransition translateTransition =
new PathTransition(Duration.seconds(2), path);
translateTransition.setCycleCount(2);
translateTransition.setInterpolator(Interpolator.EASE_IN);
translateTransition.setAutoReverse(true);
// transition that scales a shape to make it larger or smaller
ScaleTransition scaleTransition =
new ScaleTransition(Duration.seconds(1));
scaleTransition.setByX(0.75);
scaleTransition.setByY(0.75);
scaleTransition.setCycleCount(2);
scaleTransition.setInterpolator(Interpolator.EASE_OUT);
scaleTransition.setAutoReverse(true);
// transition that applies a sequence of transitions to a node
SequentialTransition sequentialTransition =
new SequentialTransition (rectangle, parallelTransition,
fadeTransition, rotateTransition, translateTransition,
scaleTransition);
sequentialTransition.play(); // play the transition
}
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:65,代码来源:TransitionAnimationsController.java
示例15: initGraphics
import javafx.animation.RotateTransition; //导入方法依赖的package包/类
private void initGraphics() {
double center = PREFERRED_WIDTH * 0.5;
double radius = PREFERRED_WIDTH * 0.45;
circle = new Circle();
circle.setCenterX(center);
circle.setCenterY(center);
circle.setRadius(radius);
circle.getStyleClass().add("indicator");
circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316);
circle.setStrokeDashOffset(dashOffset.get());
circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);
arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress());
arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
arc.setStrokeWidth(PREFERRED_WIDTH * 0.1);
arc.getStyleClass().add("indicator");
indeterminatePane = new StackPane(circle);
indeterminatePane.setVisible(false);
progressPane = new Pane(arc);
progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0);
getChildren().setAll(progressPane, indeterminatePane);
// Setup timeline animation
KeyValue kvDashOffset_0 = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH);
KeyValue kvDashOffset_50 = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH);
KeyValue kvDashOffset_100 = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH);
KeyValue kvDashArray_0_0 = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH);
KeyValue kvDashArray_0_50 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
KeyValue kvRotate_0 = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR);
KeyValue kvRotate_100 = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR);
KeyFrame kf0 = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0);
KeyFrame kf1 = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50);
KeyFrame kf2 = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100);
timeline.setCycleCount(Animation.INDEFINITE);
timeline.getKeyFrames().setAll(kf0, kf1, kf2);
// Setup additional pane rotation
indeterminatePaneRotation = new RotateTransition();
indeterminatePaneRotation.setNode(indeterminatePane);
indeterminatePaneRotation.setFromAngle(0);
indeterminatePaneRotation.setToAngle(-360);
indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR);
indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE);
indeterminatePaneRotation.setDuration(new Duration(4500));
}