1# SwipeGesture 2 3**\<SwipeGesture>** is used to implement a swipe gesture, which can be recognized when the swipe speed is 100 vp/s or higher. 4 5> **NOTE** 6> 7> This gesture is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. 8 9 10## APIs 11 12SwipeGesture(value?: { fingers?: number; direction?: SwipeDirection; speed?: number }) 13 14**Parameters** 15 16| Name| Type| Mandatory| Description| 17| -------- | -------- | -------- | -------- | 18| fingers | number | No| Minimum number of fingers to trigger a swipe gesture. The value ranges from 1 to 10.<br>Default value: **1**| 19| direction | [swipeDirection](#swipedirection)| No| Swipe direction.<br>Default value: **SwipeDirection.All**| 20| speed | number | No| Minimum speed of the swipe gesture, in vp/s.<br>Default value: **100**| 21 22## SwipeDirection 23 24| Name| Description| 25| -------- | -------- | 26| All | All directions.| 27| Horizontal | Horizontal direction. The gesture event is triggered when the angle between the finger moving direction and the x-axis is less than 45 degrees.| 28| Vertical | Vertical direction. The gesture event is triggered when the angle between the finger moving direction and the y-axis is less than 45 degrees.| 29| None | Swiping disabled.| 30 31 32## Events 33 34| Name| Description| 35| -------- | -------- | 36| onAction(event:(event?: [GestureEvent](ts-gesture-settings.md#gestureevent)) => void) | Triggered when a swipe gesture is recognized.| 37 38## Example 39 40```ts 41// xxx.ets 42@Entry 43@Component 44struct SwipeGestureExample { 45 @State rotateAngle: number = 0 46 @State speed: number = 1 47 48 build() { 49 Column() { 50 Column() { 51 Text("SwipeGesture speed\n" + this.speed) 52 Text("SwipeGesture angle\n" + this.rotateAngle) 53 } 54 .border({ width: 3 }) 55 .width(300) 56 .height(200) 57 .margin(100) 58 .rotate({ angle: this.rotateAngle }) 59 // The gesture event is triggered by swiping vertically with one finger. 60 .gesture( 61 SwipeGesture({ direction: SwipeDirection.Vertical }) 62 .onAction((event: GestureEvent) => { 63 this.speed = event.speed 64 this.rotateAngle = event.angle 65 }) 66 ) 67 }.width('100%') 68 } 69} 70``` 71 72  73