animation - TranslateTransition jumps over a few pixels -
when click , animation begins, image jumps point a quarter of distance should go , runs fine untill reaches point b know why?
this methot use image movement:
public void sky(node node, double xdest, double ydest) { translatetransition ttrans = new translatetransition( duration.seconds(4), node); // ttrans.setfromx(xplec); ttrans.settox(xdest); ttrans.setrate(2); ttrans.setinterpolator(interpolator.linear); // ttrans.setfromy(yplec); ttrans.settoy(ydest); ttrans.setrate(2); ttrans.setinterpolator(interpolator.linear); node.setlayoutx(node.getlayoutx() + xdest); node.setlayouty(node.getlayouty() + ydest); ttrans.play(); }
why set end point node before starting transition? try next code:
ttrans.setfromx(node.getlayoutx()); ttrans.settox(xdest); ttrans.setrate(2); ttrans.setinterpolator(interpolator.linear); ttrans.setfromy(node.getlayoutx()); ttrans.settoy(ydest); ttrans.play(); also note don't need call setrate , setinterpolator 2 times.
Comments
Post a Comment