0

Hi I am working with an automotive UI project using JavaFX. I am trying to rotate a speed needle image. The image is rotating from its center. I need to rotate it by from its end.How to change the point of rotation like a pivot point or something.?Here is my code

private void rotateNeedle(){
    rotateTransition = new RotateTransition(Duration.seconds(3), speedNeedle);
    rotateTransition.setFromAngle(0);
    rotateTransition.setToAngle(260);
    rotateTransition.setAutoReverse(true);
    rotateTransition.setAxis(new Point3D(0,0,10));
    if (rotateTransition.getStatus() != Animation.Status.STOPPED) {
      rotateTransition.stop();
    } else {
      rotateTransition.play();
    }
}
  • Please post your code that currently does the rotation. – Michael Sep 01 '17 at 08:45
  • Possible duplicate of [RotateTransition around a pivot?](https://stackoverflow.com/questions/28652149/rotatetransition-around-a-pivot) –  Sep 01 '17 at 09:27
  • But i am using an imageview so that couldn't able to take startX or Y properties – Arjun Koroth Sep 01 '17 at 10:18
  • The pivot is in the coordinate space of the node itself, so the top left is represented by `(0,0)`. At most you would need to use the width and the height, which you can get from `getBoundsInLocal()`. (Shapes, such as `Line`, behave differently, in that their coordinate space prior to transformations is the coordinate space of their parent, and their specific coordinate properties, such as `startX`, `startY` etc., position them within that coordinate space.) – James_D Sep 01 '17 at 12:18
  • 1
    BTW: What's the `if` construct supposed to do? What do you expect the status of the animation to be just after creating it? – fabian Sep 01 '17 at 12:40

0 Answers0