korol-joystick-speedy
v1.7.0
Published
React Native Joystick
Downloads
2
Maintainers
Readme
React Native Joystick
TOC
Installation
PreInstallation
yarn add react-native-gesture-handler
NPM
npm install korol-joystick
YARN
yarn add korol-joystick
Preview
Usage
import { KorolJoystick } from "korol-joystick";
<KorolJoystick color="#06b6d4" radius={75} onMove={(data) => console.log(data)}>
Props
radius
Set the size radius of the container circle The inside joystick radius is 1/3 of this size Type: Number
color
Set the color scheme of the joystick The color of the container and the joystick is set based on this color with a set opacity.
type: HEX Color Code
onMove, onStart, onStop
A callback function with an argument of type MoveJoystickEvent.
type: Function
Types
MoveJoystickEvent
Event returned by the onMove, onStart and onStop callbacks.
{
type: "move" | "stop" | "start";
position: {
x: number;
y: number;
}
force: number;
angle: {
radian: number;
degree: number;
}
}