在JavaFX中为RotateTransition更改组的中心点
我无法使代码正常工作。设置轴点的坐标不会更改旋转中心。我的组仍然围绕组的中心旋转。对不起,英语不好。谢谢你的帮助在JavaFX中为RotateTransition更改组的中心点,javafx,Javafx,我无法使代码正常工作。设置轴点的坐标不会更改旋转中心。我的组仍然围绕组的中心旋转。对不起,英语不好。谢谢你的帮助 public class MetronomePathTransitionMain extends Application { Ellipse ellipse; public static void main(String[] args) { launch(args); } @Override public void start
public class MetronomePathTransitionMain extends Application {
Ellipse ellipse;
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) {
ellipse = new Ellipse(100, 50, 4, 8);
ellipse.setFill(Color.BLUE);
ellipse.setRotate(-15);
Line line = new Line(0, 0, 200, 350);
line.startXProperty().bind(ellipse.centerXProperty());
line.startYProperty().bind(ellipse.centerYProperty());
Group group = new Group(ellipse,line);
Rotate rotate = new Rotate();
rotate.setPivotX(200);
rotate.setPivotY(350);
group.getTransforms().add(rotate);
RotateTransition anim = new RotateTransition(Duration.seconds(1), group);
anim.setCycleCount(Animation.INDEFINITE);
anim.setAutoReverse(true);
anim.setByAngle(30);
Scene scene = new Scene(group, 400, 500);
stage.setScene(scene);
stage.show();
anim.playFromStart();
}
}
旋转变换在旋转变换中没有效果。你可以用一个新的 朱厄西对他的主旨有深刻的理解。它应该会让你知道怎么做