我试图对 进行轮换ImageView
,每个轮换都有自己的pivot
. 一个旨在具有默认枢轴,而另一个具有 (0, 0) 作为其枢轴。在尝试执行此操作时,仅在视图上完成最后一次旋转。我怎样才能让它们同时工作?
这是我的尝试:
this.animate().rotation(180f).setDuration(0);
setPivotX(0);
setPivotY(0);
this.animate().rotation((float) Math.toDegrees(Math.atan((y2 - y1) / (x2 - x1)))).setDuration(0);
这是在实现imageView
.
您应该使用 ParallelTransition,这是我的示例:
ParallelTransition pt = new ParallelTransition();
RotateTransition rx=new RotateTransition(Duration.seconds(5), this);
rx.setAxis(Rotate.X_AXIS);
RotateTransition rz=new RotateTransition(Duration.seconds(5), this);
rz.setAxis(Rotate.Z_AXIS);
rx.setFromAngle(0);
rx.setToAngle(90*xrotate);
rz.setFromAngle(0);
rz.setToAngle(90*zrotate);
pt.getChildren().addAll(rz,rx);
pt.play();
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句