1# RotationGesture 2 3**RotationGesture** is used to trigger a rotation gesture, which requires two to five fingers with a minimum 1-degree rotation angle. 4 5> **NOTE** 6> 7> This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. 8 9 10## APIs 11 12RotationGesture(value?: { fingers?: number, angle?: number }) 13 14**Atomic service API**: This API can be used in atomic services since API version 11. 15 16**Parameters** 17 18| Name| Type| Mandatory| Description| 19| -------- | -------- | -------- | -------- | 20| fingers | number | No| Minimum number of fingers to trigger a rotation. The value ranges from 2 to 5.<br>Default value: **2**<br>While more fingers than the minimum number can be pressed to trigger the gesture, only the first two fingers participate in gesture calculation.| 21| angle | number | No| Minimum degree that can trigger the rotation gesture.<br>Default value: **1**<br>**NOTE**<br>If the value is less than or equal to 0 or greater than 360, it will be converted to the default value.| 22 23 24## Events 25 26| Parameter| Description| 27| -------- | -------- | 28| onActionStart(event:(event: [GestureEvent](ts-gesture-settings.md#gestureevent)) => void) | Triggered when a rotation gesture is recognized.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 29| onActionUpdate(event:(event: [GestureEvent](ts-gesture-settings.md#gestureevent)) => void) | Triggered when the user moves the finger in a rotation gesture on the screen.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 30| onActionEnd(event:(event: [GestureEvent](ts-gesture-settings.md#gestureevent)) => void) | Triggered when the finger used for the rotation gesture is lift.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 31| onActionCancel(event: () => void) | Triggered when a tap cancellation event is received after the rotation gesture is recognized.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 32 33## Attributes 34 35**Atomic service API**: This API can be used in atomic services since API version 11. 36 37| Name| Type |Description | 38| ---- | ------ | ---------------------------------------- | 39| tag<sup>11+</sup> | string | Tag for the rotation gesture. It is used to distinguish the gesture during custom gesture judgment.| 40 41## Example 42 43```ts 44// xxx.ets 45@Entry 46@Component 47struct RotationGestureExample { 48 @State angle: number = 0 49 @State rotateValue: number = 0 50 51 build() { 52 Column() { 53 Column() { 54 Text('RotationGesture angle:' + this.angle) 55 } 56 .height(200) 57 .width(300) 58 .padding(20) 59 .border({ width: 3 }) 60 .margin(80) 61 .rotate({ angle: this.angle }) 62 // The gesture event is triggered by rotating with two fingers. 63 .gesture( 64 RotationGesture() 65 .onActionStart((event: GestureEvent) => { 66 console.info('Rotation start') 67 }) 68 .onActionUpdate((event: GestureEvent) => { 69 if (event) { 70 this.angle = this.rotateValue + event.angle 71 } 72 }) 73 .onActionEnd((event: GestureEvent) => { 74 this.rotateValue = this.angle 75 console.info('Rotation end') 76 }) 77 ) 78 }.width('100%') 79 } 80} 81``` 82 83  84