JavaFX ImageView Transition -


i'm trying create image gallery , use image animations. problem imageview. play() rotatetransition method , call method time it's not working @ all. there should issue threads if called new thread nothing happening. there solution how work imageview , transitions generally?

public class imagegallery extends imageview{     rotatetransition rt;      public imagegallery() {         setimage(new image("/img/01.jpg"));         setpreserveratio(true);          rt = new rotatetransition(duration.millis(800), this);         rt.setbyangle(90);          //this works not need          //fitwidthproperty().addlistener(e -> rt.play());      }      public void rotateright(){         rt.play(); //nothing          //run later not working          //platform.runlater(new viewtransition(this));     } } 

thanks

as per user comments in question, adding mcve

main.java

import javafx.application.application; import javafx.geometry.pos; import javafx.scene.scene; import javafx.scene.layout.vbox; import javafx.stage.stage;  public class main extends application {      @override     public void start(stage primarystage) throws exception {          imagegallery gallery = new imagegallery();         vbox box= new vbox(gallery);         box.setalignment(pos.center);         scene scene = new scene(box, 400, 400);         primarystage.setscene(scene);         primarystage.show();         gallery.rotateright();     }      public static void main(string[] args){         launch(args);     }  } 

imagegallery.java

import javafx.animation.rotatetransition; import javafx.scene.image.image; import javafx.scene.image.imageview; import javafx.util.duration;  public class imagegallery extends imageview{     rotatetransition rt;      public imagegallery() {         setimage(new image("http://jaxenter.com/wp-content/uploads/2013/03/javafx.1.png"));         setpreserveratio(true);         rt = new rotatetransition(duration.millis(800), this);         rt.setbyangle(90);     }      public void rotateright(){         rt.play();     } } 

Popular posts from this blog