@@ -13,26 +13,30 @@ npm i github:TheProfs/pointerdriver
1313## Usage
1414
1515``` js
16- import { DragMotion , GlideMotion , StrokeMotion , PinchMotion , TwistMotion } from ' pointerdriver'
16+ import {
17+ DragMotion , GlideMotion , StrokeMotion ,
18+ PinchMotion , TwistMotion
19+ } from ' pointerdriver'
1720
18- const el = document .querySelector (' #el' )
19-
20- await new DragMotion (el, [
21+ await new DragMotion (document .querySelector (' #el' ), [
2122 [30 , 50 , 0 ],
2223 [60 , 80 , 16 ],
2324]).perform ()
2425
25- await new PinchMotion (el, 2 , { x: 60 , y: 80 }).perform ()
26+ await new PinchMotion (document .querySelector (' #el' ), 2 , {
27+ x: 60 , y: 80
28+ }).perform ()
2629
27- await new TwistMotion (el, 45 , { x: 60 , y: 80 }).perform ()
30+ await new TwistMotion (document .querySelector (' #el' ), 45 , {
31+ x: 60 , y: 80
32+ }).perform ()
2833```
2934
30- ` DragMotion ` (mouse), ` GlideMotion ` (finger), and ` StrokeMotion ` (pen)
31- take points as ` [x, y, ms] ` .
32- ` ms ` is the timestamp offset since the start of the motion.
33- Timestamps must be non-decreasing.
34- ` PinchMotion ` takes ` scale ` and ` { x, y, distance, steps } ` .
35- ` TwistMotion ` takes ` degrees ` and ` { x, y, radius, steps } ` (degrees can be negative).
35+ - ` DragMotion ` , ` GlideMotion ` and ` StrokeMotion ` take points as ` [x, y, ms] ` .
36+ - ` ms ` is the timestamp offset since the start of the motion; and must be
37+ * monotonically increasing* and * non-negative* .
38+ - ` PinchMotion ` takes ` scale ` and ` { x, y, distance, steps } ` .
39+ - ` TwistMotion ` takes ` degrees ` and ` { x, y, radius, steps } ` (can be negative).
3640
3741## Spec
3842
@@ -59,4 +63,4 @@ npm test
5963MIT
6064
6165[ test-badge] : https://github.com/TheProfs/pointerdriver/actions/workflows/test.yml/badge.svg
62- [ test] : https://github.com/TheProfs/pointerdriver/actions/workflows/test.yml
66+ [ test ] : https://github.com/TheProfs/pointerdriver/actions/workflows/test.yml
0 commit comments