Rotating arrow

Erel

B4X founder
Staff member
Licensed User
Longtime User
This is an example of using the form's ForeLayer property with the Polygon method to create a rotating arrow.
The position of each coordinate is calculated using this formula:
New X = X * Cos(degree) - Y * Sin(degree)
New Y = Y * Cos (degree) + X * Sin(degree)

As we are using the forelayer there is no need to redraw the background.
 

Attachments

  • Picture1.jpg
    Picture1.jpg
    18.3 KB · Views: 356
  • Arrow.sbp
    1.2 KB · Views: 552

derez

Expert
Licensed User
Longtime User
letter - number

Hi Erel
Thank you for this example - it was helpful for me.
Took me a while to understand why when I type the code I get an error, and if I copy it from youe example - it runs.
The problem is that "l" and "1" in the program look very similar (the name of the array is alX)
see photo.
David
 

Attachments

  • alx.JPG
    alx.JPG
    10.6 KB · Views: 357
Top