本文整理匯總了Java中javafx.animation.RotateTransition.setByAngle方法的典型用法代碼示例。如果您正苦於以下問題:Java RotateTransition.setByAngle方法的具體用法?Java RotateTransition.setByAngle怎麽用?Java RotateTransition.setByAngle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javafx.animation.RotateTransition
的用法示例。
在下文中一共展示了RotateTransition.setByAngle方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: rotateHer
import javafx.animation.RotateTransition; //導入方法依賴的package包/類
public void rotateHer(Label labelHer, ImageView iv)
{
RotateTransition rotation = new RotateTransition(Duration.seconds(2), iv);
rotation.setCycleCount(Animation.INDEFINITE);
rotation.setByAngle(360);
iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
iv.setRotationAxis(Rotate.Y_AXIS);
labelHer.setOnMouseEntered(e ->
{
rotation.play();
iv.setRotate(180);
});
labelHer.setOnMouseExited(e ->
{
rotation.pause();
iv.setRotate(0);
});
}
示例2: rotateHer
import javafx.animation.RotateTransition; //導入方法依賴的package包/類
public void rotateHer(Label labelHer, ImageView iv)
{
RotateTransition rotation = new RotateTransition(Duration.seconds(2.3), iv);
rotation.setCycleCount(Animation.INDEFINITE);
rotation.setByAngle(360);
iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
iv.setRotationAxis(Rotate.Y_AXIS);
labelHer.setOnMouseEntered(e ->
{
rotation.play();
iv.setRotate(180);
});
labelHer.setOnMouseExited(e ->
{
rotation.pause();
iv.setRotate(0);
});
}
示例3: update
import javafx.animation.RotateTransition; //導入方法依賴的package包/類
@Override
public void update (Object object) {
ITurtleState state = (ITurtleState) object;
this.penStyleIndex = state.getPenStyle();
TranslateTransition tt = new TranslateTransition(Duration.millis(mySpeed), this);
double currentX = this.getTranslateX(); double currentY = this.getTranslateY();
tt.setByX(currentX); tt.setByY(currentY); tt.setToX(state.getX()); tt.setToY(state.getY());
RotateTransition rt = new RotateTransition(Duration.millis(mySpeed), this);
double currentHeading = this.getRotate();
rt.setByAngle(currentHeading); rt.setToAngle(state.getHeading());
ParallelTransition pt = new ParallelTransition();
pt.getChildren().addAll(tt, rt);
pt.setOnFinished(e -> {
updateTurtleState(state);
System.out.println("myturtle: " + this.toString());
tooltip.setText(this.toString());
});
pt.play();
}
示例4: TestLoadingScene
import javafx.animation.RotateTransition; //導入方法依賴的package包/類
public TestLoadingScene() {
getText().setFont(Font.font("Segoe UI", 24));
getText().setTranslateY(50);
Circle circle = new Circle(50, 50, 50);
Shape shape = Shape.subtract(new Rectangle(100, 100), circle);
shape.setFill(Color.BLUE);
shape.setStroke(Color.YELLOW);
RotateTransition rt = new RotateTransition(Duration.seconds(2), shape);
rt.setByAngle(360);
rt.setCycleCount(15);
rt.play();
shape.setTranslateX(700);
shape.setTranslateY(500);
getContentRoot().getChildren().set(1, shape);
}
示例5: moveToDeck
import javafx.animation.RotateTransition; //導入方法依賴的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);
}
示例6: 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();
}
示例7: initialize
import javafx.animation.RotateTransition; //導入方法依賴的package包/類
@FXML
private void initialize() {
eventBus.register(this);
messageBox.setDisable(client.getSelectedRoom() == null);
eventListView.setCellFactory(listView -> {
EventListItemView memberListItemView = new EventListItemView();
memberListItemView.getView();
return (EventListItemPresenter)memberListItemView.getPresenter();
});
eventListView.itemsProperty().addListener((observable, oldValue, newValue) -> {
if(eventListScrollBar != null) {
eventListScrollBar.valueProperty().removeListener(scrollListener);
}
this.eventListScrollBar = getListViewScrollBar(eventListView, Orientation.VERTICAL);
if(eventListScrollBar != null) {
eventListScrollBar.valueProperty().addListener(scrollListener);
}
});
// Buffering icon animations
bufferIconAnimation = new RotateTransition(Duration.millis(1000), bufferingIcon);
bufferIconAnimation.setCycleCount(Timeline.INDEFINITE);
bufferIconAnimation.setByAngle(360);
bufferFadeIn = new FadeTransition(Duration.millis(200), bufferingIcon);
bufferFadeIn.setFromValue(0.0);
bufferFadeIn.setToValue(1.0);
bufferFadeOut = new FadeTransition(Duration.millis(200), bufferingIcon);
bufferFadeOut.setFromValue(1.0);
bufferFadeOut.setToValue(0.0);
}
示例8: queueImageView
import javafx.animation.RotateTransition; //導入方法依賴的package包/類
private ImageView queueImageView( final TileViewModel build ) {
final ImageView queuedIcon = new ImageView( UIUtils.createImage( "icons/queued.png" ) );
queuedIcon.setFitHeight( 45 );
queuedIcon.setPreserveRatio( true );
queuedIcon.visibleProperty( ).bind( build.queuedProperty( ) );
final RotateTransition transition = new RotateTransition( Duration.seconds( 3 ), queuedIcon );
transition.setByAngle( 360 );
transition.setCycleCount( Timeline.INDEFINITE );
transition.play( );
return queuedIcon;
}
示例9: getRotation
import javafx.animation.RotateTransition; //導入方法依賴的package包/類
private void getRotation(Button button){
RotateTransition rotation = new RotateTransition(Duration.seconds(3), button);
rotation.setCycleCount(Animation.INDEFINITE);
rotation.setByAngle(360);
button.setOnMouseEntered(e -> rotation.play());
button.setOnMouseExited(e -> rotation.pause());
}
示例10: 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;
}
示例11: 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;
}
示例12: eval
import javafx.animation.RotateTransition; //導入方法依賴的package包/類
@Override
public Object eval(Environment env) {
Object c = ((ASTree) condition()).eval(env);
if (c instanceof Integer) {
Sprite sprite = env.getSprite();
SequentialTransition st = env.getSequentialTransition();
RotateTransition rt = new RotateTransition(Duration.millis(env.getSpeed()), sprite);
rt.setByAngle((Integer) c);
rt.setAutoReverse(true);
st.getChildren().add(rt);
}
return c;
}
示例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: rotate
import javafx.animation.RotateTransition; //導入方法依賴的package包/類
private void rotate(double angle, Duration time){
RotateTransition flip = new RotateTransition(time, this);
flip.setAxis(Rotate.X_AXIS);
flip.setByAngle(angle);
flip.play();
}
示例15: 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