# Shape Clipping Shape clipping changes the visible portion of a component through clipping or masking. > **NOTE** > > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. ## clip12+ clip(value: boolean) Sets whether to clip the areas of child components that extend beyond this component's boundaries, that is, whether to perform clipping based on the edge contour of the parent container **System capability**: SystemCapability.ArkUI.ArkUI.Full **Widget capability**: This API can be used in ArkTS widgets since API version 12. **Atomic service API**: This API can be used in atomic services since API version 12. **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | value | boolean | Yes | Whether to perform clipping based on the edge contour of the parent container.
Default value: **false**| ## clip(deprecated) clip(value: boolean | CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute) Sets whether to clip this component based on the given shape. > **NOTE** > > This API is supported since API version 7 and deprecated since API version 12. You are advised to use [clip](#clip12) and [clipShape](#clipshape12) instead. **Widget capability**: This API can be used in ArkTS widgets since API version 9. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | value | boolean \| [CircleAttribute](ts-drawing-components-circle.md) \| [EllipseAttribute](ts-drawing-components-ellipse.md) \| [PathAttribute](ts-drawing-components-path.md) \| [RectAttribute](ts-drawing-components-rect.md) | Yes | Clip mode. If the value is a shape, the component is clipped based on the specified shape. If the value is of the Boolean type, it specifies whether to clip the component based on the edge contour of the parent container.
Default value: **false**| ## clipShape12+ clipShape(value: CircleShape | EllipseShape | PathShape | RectShape) Clips this component based on the given shape. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Widget capability**: This API can be used in ArkTS widgets since API version 12. **Atomic service API**: This API can be used in atomic services since API version 12. **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | value | [CircleShape](../js-apis-arkui-shape.md#circleshape) \| [EllipseShape](../js-apis-arkui-shape.md#ellipseshape) \| [PathShape](../js-apis-arkui-shape.md#pathshape) \| [RectShape](../js-apis-arkui-shape.md#rectshape) | Yes | Shape that the component to be clipped into.| ## mask12+ mask(value: ProgressMask) Adds a mask of the specified shape to the component. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Atomic service API**: This API can be used in atomic services since API version 12. **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------------------ | ---- | -------------------------------- | | value | [ProgressMask](#progressmask10) | Yes | Mask to add to the component, which allows for dynamic adjustment of progress, maximum value, and color settings.| ## mask(deprecated) mask(value: CircleAttribute | EllipseAttribute | PathAttribute | RectAttribute | ProgressMask) Adds a mask of the specified shape to the component. > **NOTE** > > This API is supported since API version 7 and deprecated since API version 12. You are advised to use [mask](#mask12) and [maskShape](#maskshape12) instead. **Widget capability**: This API can be used in ArkTS widgets since API version 9. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------------------ | ---- | -------------------------------- | | value | [CircleAttribute](ts-drawing-components-circle.md) \| [EllipseAttribute](ts-drawing-components-ellipse.md) \| [PathAttribute](ts-drawing-components-path.md) \| [RectAttribute](ts-drawing-components-rect.md) \| [ProgressMask](#progressmask10)10+ | Yes | Mask of the specified shape to add to the component.| ## maskShape12+ maskShape(value: CircleShape | EllipseShape | PathShape | RectShape) Adds a mask of the specified shape to the component. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Widget capability**: This API can be used in ArkTS widgets since API version 12. **Atomic service API**: This API can be used in atomic services since API version 12. **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------------------ | ---- | -------------------------------- | | value | [CircleShape](../js-apis-arkui-shape.md#circleshape) \| [EllipseShape](../js-apis-arkui-shape.md#ellipseshape) \| [PathShape](../js-apis-arkui-shape.md#pathshape) \| [RectShape](../js-apis-arkui-shape.md#rectshape) | Yes | Mask of the specified shape to add to the component.| ## ProgressMask10+ Implements a **ProgressMask** object to set the progress, maximum value, and color of the mask. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full ### constructor10+ constructor(value: number, total: number, color: ResourceColor) Constructs a **ProgressMask** object. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------ | ---- | ------------------ | | value | number | Yes | Current value of the progress mask.| | total | number | Yes | Maximum value of the progress mask.| | color | [ResourceColor](ts-types.md#resourcecolor) | Yes | Color of the progress mask. | ### updateProgress10+ updateProgress(value: number): void Updates the progress value of the progress mask. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type| Mandatory| Description | | ------ | -------- | ---- | ------------------ | | value | number | Yes | Current value of the progress mask.| ### updateColor10+ updateColor(value: ResourceColor): void Updates the color of the progress mask. **Atomic service API**: This API can be used in atomic services since API version 11. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------ | ---- | ---------------- | | value | [ResourceColor](ts-types.md#resourcecolor) | Yes | Color of the progress mask.| ### enableBreathingAnimation12+ enableBreathingAnimation(value: boolean): void Sets whether to enable the breathing animation when the progress indicator is full. By default, the breathing animation is disabled. **Atomic service API**: This API can be used in atomic services since API version 12. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------ | ---- | ---------------- | | value | boolean | Yes | Whether to enable the breathing animation. The value **true** means to enable the breathing animation, and **false** means the opposite. Default value: **false**| ## Example ### Example 1 ```ts // xxx.ets @Entry @Component struct ClipAndMaskExample { build() { Column({ space: 15 }) { Text('clip').fontSize(12).width('75%').fontColor('#DCDCDC') Row() { Image($r('app.media.testImg')).width('500px').height('280px') } .clip(true) // If clip is not set to true, the image is not confined by the rounded corners of the component and may extend beyond the component. .borderRadius(20) // Clip the image based on a circle with a diameter of 280 px. Image($r('app.media.testImg')) .clipShape(new Circle({ width: '280px', height: '280px' })) .width('500px').height('280px') Text('mask').fontSize(12).width('75%').fontColor('#DCDCDC') // Add a 500 px x 280 px square mask to the image. Image($r('app.media.testImg')) .maskShape(new Rect({ width: '500px', height: '280px' }).fill(Color.Gray)) .width('500px').height('280px') // Add a 280 px x 280 px circular mask to the image. Image($r('app.media.testImg')) .maskShape(new Circle({ width: '280px', height: '280px' }).fill(Color.Gray)) .width('500px').height('280px') } .width('100%') .margin({ top: 15 }) } } ``` ![clipAndMask](figures/clipAndMask.PNG) ### Example 2 ```ts @Entry @Component struct ProgressMaskExample { @State progressflag1: boolean = true; @State color: Color = 0x01006CDE; @State value: number = 10.0; @State enableBreathingAnimation: boolean = false; @State progress: ProgressMask = new ProgressMask(10.0, 100.0, Color.Gray); build() { Column({ space: 15 }) { Text('progress mask').fontSize(12).width('75%').fontColor('#DCDCDC') // Add a 280px x 280px progress mask to the image. Image($r('app.media.testImg')) .width('500px').height('280px') .mask(this.progress) .animation({ duration: 2000, // Animation duration. .curve(Curve.Linear) // Animation curve. delay: 0, // Animation delay. iterations: 1, // Number of playback times. playMode: PlayMode.Normal // Animation playback mode. }) // Animation configuration for the width and height attributes of the