In this guide, I will show you how to make a joystick using the Canvas component, I will particularly use it to control projects with Arduino, but with imagination you can use it in different projects.
How it looks:
What you need:
- Label (optional)
First I separate in 2 parts the “tactile” inside the Canvas to limit the movement of the joystick to the circle in the background, for this I use the equation of the circumference.
Also I make the joystick return to the center when we stop pressing.
In this part, in addition to creating the colors, sizes, etc. I create the function “createJoystickTouchExterior” where I use other mathematical equations to capture the angle in which we are currently pressing and draw the joystick in the same direction, this way the joystick will always move until we stop pressing the screen.
Joystick_test.aia (154,9 KB)