【发布时间】:2014-12-31 11:07:30
【问题描述】:
我有一个问题,是否可以在 Raspberry Pi 上使用 JavaFX 制作动画? 我正在使用此代码:
public class PhotoRotateTransition
{
private ImageView imageView;
public PhotoRotateTransition(ImageView imageView, Image img){
this.imageView = imageView;
this.changeImage(img);
}
private void changeImage(Image img){
this.imageView.setRotate(0);
RotateTransition rotate1 = this.rotate1();
rotate1.play();
rotate1.setOnFinished(new EventHandler<ActionEvent>()
{
@Override
public void handle(ActionEvent event)
{
imageView.setRotate(270);
imageView.setImage(img);
RotateTransition rotate2 = rotate2();
rotate2.play();
}
});
}
private RotateTransition rotate1(){
RotateTransition rotateTransition = new RotateTransition(Duration.millis(500), this.imageView);
rotateTransition.setAxis(Rotate.Y_AXIS);
rotateTransition.setToAngle(90);
rotateTransition.setInterpolator(Interpolator.LINEAR);
rotateTransition.setCycleCount(1);
return rotateTransition;
}
private RotateTransition rotate2(){
RotateTransition rotateTransition2 = new RotateTransition(Duration.millis(500), this.imageView);
rotateTransition2.setAxis(Rotate.Y_AXIS);
rotateTransition2.setToAngle(360);
rotateTransition2.setInterpolator(Interpolator.LINEAR);
rotateTransition2.setCycleCount(1);
return rotateTransition2;
}
}
此代码适用于我的 Mac,但树莓派上的图像只是在没有过渡的情况下发生变化。 有人可以帮我弄这个吗? 非常感谢。
【问题讨论】:
标签: java javafx raspberry-pi transition javafx-8