B4J Question Rotate Application 90 Degress

ThRuST

Well-Known Member
Licensed User
Any sufficiently advanced technology is indistinguishable from magic
Love that quote :) I haven't tried your magic formula yet, but I'll do that later and let you know if I'm teleported to Coruscant, or not ;)
 

ThRuST

Well-Known Member
Licensed User
Ok now I have clicked the "roller-coaster button", it was nice, an upside down experience so to speak, a dizzy experience :confused::)
The new XUI library needs to be explored, so I assume Erel made a tutorial for this that I should watch. Nice example I'll explore it further.

Cheers :)
 

emexes

Well-Known Member
Licensed User
And For Bonus Points, May I Present?...

I added the following code at the end of the AppStart Sub:
B4X:
'...
    MainForm.Show
 
    Dim RootPain As B4XView = MainForm.RootPane
    Do While True
        RootPain.Rotation = Sin(DateTime.Now * 0.0003) * 360
        RootPain.Top = Sin(DateTime.Now * 0.0011) * 200
        RootPain.Left = Sin(DateTime.Now * 0.0017) * 200
        Sleep(15)
    Loop
 
End Sub
and suddenly the previous demo turned into an action video game of "Click That Button".

Use keyboard: Tab moves focus from button to button, Space clicks current button.
 
Last edited:

emexes

Well-Known Member
Licensed User
B4X:
'...
    MainForm.Show
 
    Dim RootPain As B4XView = MainForm.RootPane
    Do While True
        RootPain.SetRotationAnimated(700, Rnd(0, 359))
        RootPain.SetLayoutAnimated(700, Rnd(-200, 200), Rnd(-200, 200), 123, 123)    '123 = no effect
        Sleep(1000)
    Loop
I really need to let this go ;-)
 
Last edited:

jmon

Well-Known Member
Licensed User
I'm not sure if this thread is considered solved or not. I have another solution using JavaObject:


B4X:
Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Main") 'Load the layout file.
    MainForm.Show
    
    RotateNode(MainForm.RootPane, 90)
End Sub

Sub RotateNode(View As JavaObject, Angle As Double)   
    Dim Rot As JavaObject
    Rot.InitializeNewInstance("javafx.scene.transform.Rotate", Null)
    Rot.RunMethod("setAngle", Array(Angle))
    Rot.RunMethod("setPivotX", Array(View.RunMethod("getWidth", Null) /2))
    Rot.RunMethod("setPivotY", Array(View.RunMethod("getHeight", Null) /2))

    Dim Transforms As JavaObject
    Transforms = View.RunMethod("getTransforms", Null)
    Transforms.RunMethod("add", Array(Rot))   
End Sub
You can also change the pivot.
 
Top