How to create a Joystick with the Canvas component

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:

  • Canvas
  • Label (optional)

Canvas Properties:

Blocks

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.

Donwload AIA

Joystick_test.aia (154,9 KB)

21 Likes

Nice guide :+1:

Great job!

Nice very good

Sooo cool! Thank you very much!

Also, how to make this working if the screen rotates/turns?

Sorry if this is a dumb question, i’m a newcomer.
:grimacing:
yosh

I always liked how this user made a joystick simulator.

2 Likes

Thank you for this! :+1:

1 Like