1# PinchGesture 2 3**PinchGesture** is used to trigger a pinch gesture, which requires two to five fingers with a minimum 3 vp distance between the fingers. 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 12PinchGesture(value?: { fingers?: number, distance?: number }) 13 14**Parameters** 15 16| Name| Type| Mandatory| Description| 17| -------- | -------- | -------- | -------- | 18| fingers | number | No| Minimum number of fingers to trigger a pinch. The value ranges from 2 to 5.<br>Default value: **2**| 19| distance | number | No| Minimum recognition distance, in vp.<br>Default value: **3**| 20 21 22## Events 23 24| Name| Description| 25| -------- | -------- | 26| onActionStart(event:(event?: [GestureEvent](ts-gesture-settings.md#gestureevent)) => void) | Triggered when a pinch gesture is recognized.| 27| onActionUpdate(event:(event?: [GestureEvent](ts-gesture-settings.md#gestureevent)) => void) | Triggered when the user moves the finger in a pinch gesture on the screen.| 28| onActionEnd(event:(event?: [GestureEvent](ts-gesture-settings.md#gestureevent)) => void) | Triggered when the finger used for a pinch gesture is lift.| 29| onActionCancel(event: () => void) | Triggered when a tap cancellation event is received after a pinch gesture is recognized.| 30 31 32## Example 33 34```ts 35// xxx.ets 36@Entry 37@Component 38struct PinchGestureExample { 39 @State scaleValue: number = 1 40 @State pinchValue: number = 1 41 @State pinchX: number = 0 42 @State pinchY: number = 0 43 44 build() { 45 Column() { 46 Column() { 47 Text('PinchGesture scale:\n' + this.scaleValue) 48 Text('PinchGesture center:\n(' + this.pinchX + ',' + this.pinchY + ')') 49 } 50 .height(200) 51 .width(300) 52 .padding(20) 53 .border({ width: 3 }) 54 .margin({ top: 100 }) 55 .scale({ x: this.scaleValue, y: this.scaleValue, z: 1 }) 56 // The gesture event is triggered by pinching three fingers together. 57 .gesture( 58 PinchGesture({ fingers: 3 }) 59 .onActionStart((event: GestureEvent) => { 60 console.info('Pinch start') 61 }) 62 .onActionUpdate((event: GestureEvent) => { 63 this.scaleValue = this.pinchValue * event.scale 64 this.pinchX = event.pinchCenterX 65 this.pinchY = event.pinchCenterY 66 }) 67 .onActionEnd(() => { 68 this.pinchValue = this.scaleValue 69 console.info('Pinch end') 70 }) 71 ) 72 }.width('100%') 73 } 74} 75``` 76 77  78