dualsense-ts 2.1.44 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,10 @@
1
1
  import { Axis } from "./axis";
2
2
  import { Momentary } from "./momentary";
3
3
  import { Input, InputParams } from "../input";
4
- import { Radians, Degrees, Magnitude } from "../math";
4
+ import { Radians, Degrees, Magnitude, Force } from "../math";
5
+ /**
6
+ * Configuration for an analog joystick and its basic inputs.
7
+ */
5
8
  export interface AnalogParams extends InputParams {
6
9
  button?: InputParams;
7
10
  x?: InputParams;
@@ -18,21 +21,61 @@ export interface AnalogParams extends InputParams {
18
21
  */
19
22
  export declare class Analog extends Input<Analog> {
20
23
  readonly state: Analog;
24
+ /**
25
+ * The left/right position of the input.
26
+ */
21
27
  readonly x: Axis;
28
+ /**
29
+ * The up/down position of the input.
30
+ */
22
31
  readonly y: Axis;
32
+ /**
33
+ * Button triggered by pressing the stick.
34
+ */
23
35
  readonly button: Momentary;
24
36
  constructor(params?: AnalogParams);
37
+ /**
38
+ * Returns true if the stick is away from the idle position, or the button is pressed.
39
+ */
25
40
  get active(): boolean;
41
+ /**
42
+ * Returns a direction and magnitude representing the stick's position.
43
+ */
26
44
  get vector(): {
27
- direction: number;
28
- magnitude: number;
45
+ direction: Radians;
46
+ magnitude: Magnitude;
29
47
  };
48
+ /**
49
+ * Returns an force from the stick's position.
50
+ */
51
+ get force(): Force;
52
+ /**
53
+ * Returns a magnitude from the stick's position.
54
+ */
30
55
  get magnitude(): Magnitude;
56
+ /**
57
+ * Returns the stick's angle in radians.
58
+ */
31
59
  get direction(): Radians;
60
+ /**
61
+ * Alias for `.direction`
62
+ */
32
63
  get radians(): Radians;
64
+ /**
65
+ * Alias for `.direction`
66
+ */
33
67
  get angle(): Radians;
68
+ /**
69
+ * Alias for `.direction` converted to degrees.
70
+ */
34
71
  get directionDegrees(): Degrees;
72
+ /**
73
+ * Alias for `.directionDegrees`.
74
+ */
35
75
  get degrees(): Degrees;
76
+ /**
77
+ * Alias for `.directionDegrees`.
78
+ */
36
79
  get angleDegrees(): Degrees;
37
80
  }
38
81
  //# sourceMappingURL=analog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"analog.d.ts","sourceRoot":"","sources":["../../src/elements/analog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEtD,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,CAAC,CAAC,EAAE,WAAW,CAAC;IAChB,CAAC,CAAC,EAAE,WAAW,CAAC;IAChB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,qBAAa,MAAO,SAAQ,KAAK,CAAC,MAAM,CAAC;IACvC,SAAgB,KAAK,EAAE,MAAM,CAAQ;IAErC,SAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,SAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,SAAgB,MAAM,EAAE,SAAS,CAAC;gBAEtB,MAAM,CAAC,EAAE,YAAY;IAejC,IAAW,MAAM,IAAI,OAAO,CAE3B;IAGD,IAAW,MAAM,IAAI;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAE5D;IAGD,IAAW,SAAS,IAAI,SAAS,CAEhC;IAGD,IAAW,SAAS,IAAI,OAAO,CAE9B;IAGD,IAAW,OAAO,IAAI,OAAO,CAE5B;IAGD,IAAW,KAAK,IAAI,OAAO,CAE1B;IAGD,IAAW,gBAAgB,IAAI,OAAO,CAErC;IAGD,IAAW,OAAO,IAAI,OAAO,C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K,IAAI,OAAO,CAE1B;IAED;;OAEG;IACH,IAAW,gBAAgB,IAAI,OAAO,CAErC;IAED;;OAEG;IACH,IAAW,OAAO,IAAI,OAAO,CAE5B;IAED;;OAEG;IACH,IAAW,YAAY,IAAI,OAAO,CAEjC;CACF"}
@@ -16,43 +16,70 @@ class Analog extends input_1.Input {
16
16
  constructor(params) {
17
17
  super(params);
18
18
  this.state = this;
19
- this.button = new momentary_1.Momentary(params?.button || { icon: "3", name: "Button" });
20
- this.x = new axis_1.Axis(params?.x || { icon: "", name: "X", threshold: (1 / 128) * 3 });
21
- this.y = new axis_1.Axis(params?.y || { icon: "", name: "Y", threshold: (1 / 128) * 3 });
19
+ const { button, x, y, threshold } = params || {};
20
+ this.button = new momentary_1.Momentary(button || { icon: "3", name: "Button" });
21
+ this.x = new axis_1.Axis(x || { icon: "", name: "X", threshold: threshold || (1 / 128) * 6 });
22
+ this.y = new axis_1.Axis(y || { icon: "↕", name: "Y", threshold: threshold || (1 / 128) * 6 });
22
23
  }
23
- // Returns true if the stick is away from the idle position, or the button is pressed.
24
+ /**
25
+ * Returns true if the stick is away from the idle position, or the button is pressed.
26
+ */
24
27
  get active() {
25
- return this.magnitude > this.threshold || this.button.active;
28
+ return this.x.active || this.y.active || this.button.active;
26
29
  }
27
- // Returns a direction and magnitude representing the stick's position.
30
+ /**
31
+ * Returns a direction and magnitude representing the stick's position.
32
+ */
28
33
  get vector() {
29
34
  return { direction: this.direction, magnitude: this.magnitude };
30
35
  }
31
- // Returns the magnitude of the stick's position.
36
+ /**
37
+ * Returns an force from the stick's position.
38
+ */
39
+ get force() {
40
+ return this.active
41
+ ? Math.max(Math.min(Math.hypot(this.x.state, this.y.state), 1), -1)
42
+ : 0;
43
+ }
44
+ /**
45
+ * Returns a magnitude from the stick's position.
46
+ */
32
47
  get magnitude() {
33
- return Math.min(Math.abs(Math.hypot(this.x.state, this.y.state)), 1);
48
+ return Math.abs(this.force);
34
49
  }
35
- // Returns the angle related to the stick's position in radians.
50
+ /**
51
+ * Returns the stick's angle in radians.
52
+ */
36
53
  get direction() {
37
54
  return Math.atan2(this.y.state, this.x.state);
38
55
  }
39
- // Alias for `.direction`
56
+ /**
57
+ * Alias for `.direction`
58
+ */
40
59
  get radians() {
41
60
  return this.direction;
42
61
  }
43
- // Alias for `.direction`
62
+ /**
63
+ * Alias for `.direction`
64
+ */
44
65
  get angle() {
45
66
  return this.direction;
46
67
  }
47
- // Alias for `.direction` converted to degrees.
68
+ /**
69
+ * Alias for `.direction` converted to degrees.
70
+ */
48
71
  get directionDegrees() {
49
72
  return (this.direction * 180) / Math.PI;
50
73
  }
51
- // Alias for `.directionDegrees`.
74
+ /**
75
+ * Alias for `.directionDegrees`.
76
+ */
52
77
  get degrees() {
53
78
  return this.directionDegrees;
54
79
  }
55
- // Alias for `.directionDegrees`.
80
+ /**
81
+ * Alias for `.directionDegrees`.
82
+ */
56
83
  get angleDegrees() {
57
84
  return this.directionDegrees;
58
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"analog.js","sourceRoot":"","sources":["../../src/elements/analog.ts"],"names":[],"mappings":";;;AAAA,iCAA8B;AAC9B,2CAAwC;AACxC,oCAA8C;AAU9C;;;;;;;GAOG;AACH,MAAa,MAAO,SAAQ,aAAa;IAOvC,YAAY,MAAqB;QAC/B,KAAK,CAAC,MAAM,CAAC,CAAC;QAPA,UAAK,GAAW,IAAI,CAAC;QASnC,IAAI,CAAC,MAAM,GAAG,IAAI,qBAAS,CACzB,MAAM,EAAE,MAAM,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAChD,CAAC;QACF,IAAI,CAAC,CAAC,GAAG,IAAI,WAAI,CACf,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,EAAE,CAChE,CAAC;QACF,IAAI,CAAC,CAAC,GAAG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AAE,IAAI,CAAC,SAAS,EAAE,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM;YAChB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACnE,CAAC,CAAC,CAAC,CAAC;IACR,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED;;OAEG;IACH,IAAW,gBAAgB;QACzB,OAAO,CAAC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IAC1C,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,IAAW,YAAY;QACrB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CACF;AApGD,wBAoGC"}
@@ -8,13 +8,13 @@ class Axis extends input_1.Input {
8
8
  this.state = 0;
9
9
  }
10
10
  get active() {
11
- return this.magnitude > this.threshold;
11
+ return Math.abs(this.state) > this.threshold;
12
12
  }
13
13
  get force() {
14
- return this.state;
14
+ return this.active ? this.state : 0;
15
15
  }
16
16
  get magnitude() {
17
- return Math.abs(this.state);
17
+ return Math.abs(this.force);
18
18
  }
19
19
  }
20
20
  exports.Axis = Axis;
@@ -1 +1 @@
1
- {"version":3,"file":"axis.js","sourceRoot":"","sources":["../../src/elements/axis.ts"],"names":[],"mappings":";;;AAAA,oCAAiC;AAGjC,MAAa,IAAK,SAAQ,aAAY;IAAtC;;QACS,UAAK,GAAU,CAAC,CAAC;IAa1B,CAAC;IAXC,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC;IACzC,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF;AAdD,oBAcC"}
1
+ {"version":3,"file":"axis.js","sourceRoot":"","sources":["../../src/elements/axis.ts"],"names":[],"mappings":";;;AAAA,oCAAiC;AAGjC,MAAa,IAAK,SAAQ,aAAY;IAAtC;;QACS,UAAK,GAAU,CAAC,CAAC;IAa1B,CAAC;IAXC,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC;IAC/C,CAAC;IAED,IAAW,KAAK;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;CACF;AAdD,oBAcC"}
package/docs/Analog.md CHANGED
@@ -50,6 +50,7 @@ The joystick is abstracted to a unit circle.
50
50
  - [degrees](../wiki/Analog#degrees)
51
51
  - [direction](../wiki/Analog#direction)
52
52
  - [directionDegrees](../wiki/Analog#directiondegrees)
53
+ - [force](../wiki/Analog#force)
53
54
  - [magnitude](../wiki/Analog#magnitude)
54
55
  - [radians](../wiki/Analog#radians)
55
56
  - [vector](../wiki/Analog#vector)
@@ -107,7 +108,7 @@ The joystick is abstracted to a unit circle.
107
108
 
108
109
  #### Defined in
109
110
 
110
- [src/elements/analog.ts:28](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L28)
111
+ [src/elements/analog.ts:40](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L40)
111
112
 
112
113
  ## Properties
113
114
 
@@ -136,7 +137,7 @@ The joystick is abstracted to a unit circle.
136
137
 
137
138
  #### Defined in
138
139
 
139
- [src/input.ts:128](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L128)
140
+ [src/input.ts:128](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L128)
140
141
 
141
142
  ___
142
143
 
@@ -150,7 +151,7 @@ ___
150
151
 
151
152
  #### Defined in
152
153
 
153
- [src/input.ts:162](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L162)
154
+ [src/input.ts:162](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L162)
154
155
 
155
156
  ___
156
157
 
@@ -164,7 +165,7 @@ ___
164
165
 
165
166
  #### Defined in
166
167
 
167
- [src/input.ts:157](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L157)
168
+ [src/input.ts:157](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L157)
168
169
 
169
170
  ___
170
171
 
@@ -178,7 +179,7 @@ ___
178
179
 
179
180
  #### Defined in
180
181
 
181
- [src/input.ts:154](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L154)
182
+ [src/input.ts:154](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L154)
182
183
 
183
184
  ___
184
185
 
@@ -192,7 +193,7 @@ ___
192
193
 
193
194
  #### Defined in
194
195
 
195
- [src/input.ts:160](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L160)
196
+ [src/input.ts:160](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L160)
196
197
 
197
198
  ___
198
199
 
@@ -200,9 +201,11 @@ ___
200
201
 
201
202
  • `Readonly` **button**: [`Momentary`](../wiki/Momentary)
202
203
 
204
+ Button triggered by pressing the stick.
205
+
203
206
  #### Defined in
204
207
 
205
- [src/elements/analog.ts:26](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L26)
208
+ [src/elements/analog.ts:38](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L38)
206
209
 
207
210
  ___
208
211
 
@@ -216,7 +219,7 @@ ___
216
219
 
217
220
  #### Defined in
218
221
 
219
- [src/input.ts:58](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L58)
222
+ [src/input.ts:58](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L58)
220
223
 
221
224
  ___
222
225
 
@@ -230,7 +233,7 @@ ___
230
233
 
231
234
  #### Defined in
232
235
 
233
- [src/input.ts:61](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L61)
236
+ [src/input.ts:61](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L61)
234
237
 
235
238
  ___
236
239
 
@@ -244,7 +247,7 @@ ___
244
247
 
245
248
  #### Defined in
246
249
 
247
- [src/input.ts:64](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L64)
250
+ [src/input.ts:64](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L64)
248
251
 
249
252
  ___
250
253
 
@@ -258,7 +261,7 @@ ___
258
261
 
259
262
  #### Defined in
260
263
 
261
- [src/elements/analog.ts:22](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L22)
264
+ [src/elements/analog.ts:25](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L25)
262
265
 
263
266
  ___
264
267
 
@@ -272,7 +275,7 @@ ___
272
275
 
273
276
  #### Defined in
274
277
 
275
- [src/input.ts:67](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L67)
278
+ [src/input.ts:67](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L67)
276
279
 
277
280
  ___
278
281
 
@@ -280,9 +283,11 @@ ___
280
283
 
281
284
  • `Readonly` **x**: [`Axis`](../wiki/Axis)
282
285
 
286
+ The left/right position of the input.
287
+
283
288
  #### Defined in
284
289
 
285
- [src/elements/analog.ts:24](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L24)
290
+ [src/elements/analog.ts:30](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L30)
286
291
 
287
292
  ___
288
293
 
@@ -290,9 +295,11 @@ ___
290
295
 
291
296
  • `Readonly` **y**: [`Axis`](../wiki/Axis)
292
297
 
298
+ The up/down position of the input.
299
+
293
300
  #### Defined in
294
301
 
295
- [src/elements/analog.ts:25](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L25)
302
+ [src/elements/analog.ts:34](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L34)
296
303
 
297
304
  ___
298
305
 
@@ -376,7 +383,7 @@ Input.\_\_@toStringTag@66
376
383
 
377
384
  #### Defined in
378
385
 
379
- [src/input.ts:149](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L149)
386
+ [src/input.ts:149](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L149)
380
387
 
381
388
  ___
382
389
 
@@ -384,6 +391,8 @@ ___
384
391
 
385
392
  • `get` **active**(): `boolean`
386
393
 
394
+ Returns true if the stick is away from the idle position, or the button is pressed.
395
+
387
396
  #### Returns
388
397
 
389
398
  `boolean`
@@ -394,7 +403,7 @@ Input.active
394
403
 
395
404
  #### Defined in
396
405
 
397
- [src/elements/analog.ts:43](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L43)
406
+ [src/elements/analog.ts:56](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L56)
398
407
 
399
408
  ___
400
409
 
@@ -402,13 +411,15 @@ ___
402
411
 
403
412
  • `get` **angle**(): `number`
404
413
 
414
+ Alias for `.direction`
415
+
405
416
  #### Returns
406
417
 
407
418
  `number`
408
419
 
409
420
  #### Defined in
410
421
 
411
- [src/elements/analog.ts:68](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L68)
422
+ [src/elements/analog.ts:100](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L100)
412
423
 
413
424
  ___
414
425
 
@@ -416,13 +427,15 @@ ___
416
427
 
417
428
  • `get` **angleDegrees**(): `number`
418
429
 
430
+ Alias for `.directionDegrees`.
431
+
419
432
  #### Returns
420
433
 
421
434
  `number`
422
435
 
423
436
  #### Defined in
424
437
 
425
- [src/elements/analog.ts:83](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L83)
438
+ [src/elements/analog.ts:121](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L121)
426
439
 
427
440
  ___
428
441
 
@@ -430,13 +443,15 @@ ___
430
443
 
431
444
  • `get` **degrees**(): `number`
432
445
 
446
+ Alias for `.directionDegrees`.
447
+
433
448
  #### Returns
434
449
 
435
450
  `number`
436
451
 
437
452
  #### Defined in
438
453
 
439
- [src/elements/analog.ts:78](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L78)
454
+ [src/elements/analog.ts:114](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L114)
440
455
 
441
456
  ___
442
457
 
@@ -444,13 +459,15 @@ ___
444
459
 
445
460
  • `get` **direction**(): `number`
446
461
 
462
+ Returns the stick's angle in radians.
463
+
447
464
  #### Returns
448
465
 
449
466
  `number`
450
467
 
451
468
  #### Defined in
452
469
 
453
- [src/elements/analog.ts:58](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L58)
470
+ [src/elements/analog.ts:86](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L86)
454
471
 
455
472
  ___
456
473
 
@@ -458,13 +475,31 @@ ___
458
475
 
459
476
  • `get` **directionDegrees**(): `number`
460
477
 
478
+ Alias for `.direction` converted to degrees.
479
+
480
+ #### Returns
481
+
482
+ `number`
483
+
484
+ #### Defined in
485
+
486
+ [src/elements/analog.ts:107](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L107)
487
+
488
+ ___
489
+
490
+ ### force
491
+
492
+ • `get` **force**(): `number`
493
+
494
+ Returns an force from the stick's position.
495
+
461
496
  #### Returns
462
497
 
463
498
  `number`
464
499
 
465
500
  #### Defined in
466
501
 
467
- [src/elements/analog.ts:73](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L73)
502
+ [src/elements/analog.ts:70](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L70)
468
503
 
469
504
  ___
470
505
 
@@ -472,13 +507,15 @@ ___
472
507
 
473
508
  • `get` **magnitude**(): `number`
474
509
 
510
+ Returns a magnitude from the stick's position.
511
+
475
512
  #### Returns
476
513
 
477
514
  `number`
478
515
 
479
516
  #### Defined in
480
517
 
481
- [src/elements/analog.ts:53](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L53)
518
+ [src/elements/analog.ts:79](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L79)
482
519
 
483
520
  ___
484
521
 
@@ -486,13 +523,15 @@ ___
486
523
 
487
524
  • `get` **radians**(): `number`
488
525
 
526
+ Alias for `.direction`
527
+
489
528
  #### Returns
490
529
 
491
530
  `number`
492
531
 
493
532
  #### Defined in
494
533
 
495
- [src/elements/analog.ts:63](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L63)
534
+ [src/elements/analog.ts:93](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L93)
496
535
 
497
536
  ___
498
537
 
@@ -500,6 +539,8 @@ ___
500
539
 
501
540
  • `get` **vector**(): `Object`
502
541
 
542
+ Returns a direction and magnitude representing the stick's position.
543
+
503
544
  #### Returns
504
545
 
505
546
  `Object`
@@ -511,7 +552,7 @@ ___
511
552
 
512
553
  #### Defined in
513
554
 
514
- [src/elements/analog.ts:48](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/elements/analog.ts#L48)
555
+ [src/elements/analog.ts:63](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/elements/analog.ts#L63)
515
556
 
516
557
  ## Methods
517
558
 
@@ -532,7 +573,7 @@ And decide if this is the root Input.
532
573
 
533
574
  #### Defined in
534
575
 
535
- [src/input.ts:168](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L168)
576
+ [src/input.ts:168](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L168)
536
577
 
537
578
  ___
538
579
 
@@ -557,7 +598,7 @@ ___
557
598
 
558
599
  #### Defined in
559
600
 
560
- [src/input.ts:190](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L190)
601
+ [src/input.ts:190](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L190)
561
602
 
562
603
  ___
563
604
 
@@ -582,7 +623,7 @@ ___
582
623
 
583
624
  #### Defined in
584
625
 
585
- [src/input.ts:194](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L194)
626
+ [src/input.ts:194](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L194)
586
627
 
587
628
  ___
588
629
 
@@ -600,7 +641,7 @@ ___
600
641
 
601
642
  #### Defined in
602
643
 
603
- [src/input.ts:186](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L186)
644
+ [src/input.ts:186](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L186)
604
645
 
605
646
  ___
606
647
 
@@ -631,7 +672,7 @@ ___
631
672
 
632
673
  #### Defined in
633
674
 
634
- [src/input.ts:199](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L199)
675
+ [src/input.ts:199](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L199)
635
676
 
636
677
  ___
637
678
 
@@ -657,7 +698,7 @@ Update the input's state and trigger all necessary callbacks.
657
698
 
658
699
  #### Defined in
659
700
 
660
- [src/input.ts:215](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L215)
701
+ [src/input.ts:215](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L215)
661
702
 
662
703
  ___
663
704
 
@@ -675,7 +716,7 @@ ___
675
716
 
676
717
  #### Defined in
677
718
 
678
- [src/input.ts:139](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L139)
719
+ [src/input.ts:139](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L139)
679
720
 
680
721
  ___
681
722
 
@@ -693,7 +734,7 @@ ___
693
734
 
694
735
  #### Defined in
695
736
 
696
- [src/input.ts:131](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L131)
737
+ [src/input.ts:131](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L131)
697
738
 
698
739
  ___
699
740
 
@@ -717,7 +758,7 @@ ___
717
758
 
718
759
  #### Defined in
719
760
 
720
- [src/input.ts:143](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L143)
761
+ [src/input.ts:143](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L143)
721
762
 
722
763
  ___
723
764
 
@@ -771,7 +812,7 @@ ___
771
812
 
772
813
  #### Defined in
773
814
 
774
- [src/input.ts:44](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L44)
815
+ [src/input.ts:44](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L44)
775
816
 
776
817
  ___
777
818
 
@@ -920,7 +961,7 @@ Resolves on the next change to this input's state.
920
961
 
921
962
  #### Defined in
922
963
 
923
- [src/input.ts:78](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L78)
964
+ [src/input.ts:78](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L78)
924
965
 
925
966
  ___
926
967
 
@@ -974,7 +1015,7 @@ ___
974
1015
 
975
1016
  #### Defined in
976
1017
 
977
- [src/input.ts:37](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L37)
1018
+ [src/input.ts:37](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L37)
978
1019
 
979
1020
  ___
980
1021
 
@@ -1129,7 +1170,7 @@ Resolves on the next change to this input's state.
1129
1170
 
1130
1171
  #### Defined in
1131
1172
 
1132
- [src/input.ts:91](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L91)
1173
+ [src/input.ts:91](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L91)
1133
1174
 
1134
1175
  ___
1135
1176
 
@@ -1373,7 +1414,7 @@ Render a convenient debugging string.
1373
1414
 
1374
1415
  #### Defined in
1375
1416
 
1376
- [src/input.ts:102](https://github.com/nsfm/dualsense-ts/blob/6f02111/src/input.ts#L102)
1417
+ [src/input.ts:102](https://github.com/nsfm/dualsense-ts/blob/8aeab4d/src/input.ts#L102)
1377
1418
 
1378
1419
  ___
1379
1420