3
我使用RotateTransition旋转图像,如果(x,y)最初是该图像上某个点的位置,并且位置将随图像旋转而不断变化。 我想知道在任何特定时间点的重要性。 如何获得这一点的新位置?我下面RotateTransition当前角度javafx2
ImageView wheel= new ImageView();
wheel.setImage(image);
rotateTransition = new RotateTransition(Duration.seconds(10), wheel);
rotateTransition.setFromAngle(0);
rotateTransition.setToAngle(360);
rotateTransition.setInterpolator(Interpolator.LINEAR);
rotateTransition.setCycleCount(Timeline.INDEFINITE);
//当前方法似乎并不准确:
rotateTransition.currentTimeProperty().addListener(
new ChangeListener<Duration>() {public void changed(ObservableValue<? extends Duration> ov, Duration t, Duration t1) {
double degree = ((360 * t.toSeconds())/10);
xVal.set(((120) * Math.cos(degree * (Math.PI/180))) + 162.5);
yVal.set(((120) * Math.sin(degree * (Math.PI/180)) + 162.5));
}
谢谢,它工作:) – 2013-03-05 15:05:03
我很乐意提供帮助。 – gontard 2013-03-05 15:21:01