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