### Rotate Node like ProgressBar

This is an example of rotating a node on the canvas, like a ProgressBar
A timer rotates the node by changing the value of a slider in the range 0 to 360.
The rotating is done by using a JavaObject which gets a node assigned and then calls API Method setRotate.
Reference: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/Node.html
Reference: https://docs.oracle.com/javafx/2/api/javafx/scene/Node.html
Example
B4J Code
`Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private sliderRotate As Slider
Private lblRotating As Label
Private imageRotating As ImageView
Private tmr As Timer
End Sub`
`Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Title = "B4J HowTo Rotate a Node"
MainForm.RootPane.LoadLayout("Main")
MainForm.SetFormStyle("UTILITY")
MainForm.RootPane.Style = "-fx-background-color:white"
MainForm.Show
'
tmr.Initialize("tmr", 1000)
tmr.Enabled = True
End Sub`
`Sub tmr_Tick
sliderRotate.Value = sliderRotate.Value + 10
If sliderRotate.Value = 360 Then sliderRotate.Value = 0
End Sub`
`Sub RotateNode(n As Node, Degree As Double)
Dim jo As JavaObject = n
jo.RunMethod("setRotate", Array(Degree))
End Sub`
`Sub sliderRotate_ValueChange (Value As Double)
RotateNode(lblRotating, Value)
RotateNode(imageRotating, Value)
End Sub`
Layout Nodes
Slider sliderRotate
Label lblRotating
ImageView imageRotating

Changed: , Category: Nodes, File: T6C225M1670.htm, ID: 1670