display
@@ -262,7 +259,7 @@ Only the following style attributes are supported.
-## Event
+## Events
Events in [Universal Events](js-components-common-events.md) are supported.
@@ -273,6 +270,7 @@ Not supported
## Example
```
+
@@ -283,5 +281,5 @@ Not supported
```
-![](figures/progress-43.jpg)
+![](figures/progress-7.jpg)
diff --git a/en/application-dev/reference/arkui-js/js-components-basic-toolbar.md b/en/application-dev/reference/arkui-js/js-components-basic-toolbar.md
index e5b019c80be41ff3d67d015b69f73aeb94d79f3a..3f0e8675f69a606e6cbcb145e48bc5cd1591eab1 100644
--- a/en/application-dev/reference/arkui-js/js-components-basic-toolbar.md
+++ b/en/application-dev/reference/arkui-js/js-components-basic-toolbar.md
@@ -2,10 +2,7 @@
The **** component provides a bar that is usually placed at the bottom of a page to display operation options for the page.
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->This component is supported since API version 5.
-
-## Permission List
+## Required Permissions
None
@@ -17,18 +14,18 @@ Only the **** component is supported.
>A maximum of five **** components can be contained in a **** component. If there are six or more, only the first four are displayed, and the rest items are hidden in the **More** list of the toolbar. Users can click **More** to view the hidden items.
>The list is displayed in the default style instead of a customized style set for the **** component.
-## Attribute
+## Attributes
Attributes in [Universal Attributes](js-components-common-attributes.md) are supported.
-## Style
+## Styles
Styles in [Universal Styles](js-components-common-styles.md) are supported.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- The **height** style is not supported. The height is fixed at 56px.
+>The **height** style is not supported. The height is fixed at 56px.
-## Event
+## Events
None
diff --git a/en/application-dev/reference/arkui-js/js-components-canvas-canvas.md b/en/application-dev/reference/arkui-js/js-components-canvas-canvas.md
index 54f78a8571f38e3840bc1a485132434984e11758..8a29479f73e396ee3b4d7a591025ce538b70967e 100644
--- a/en/application-dev/reference/arkui-js/js-components-canvas-canvas.md
+++ b/en/application-dev/reference/arkui-js/js-components-canvas-canvas.md
@@ -2,62 +2,166 @@
The **** component is used for customizing drawings.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
Not supported
-## Attribute
+## Attributes
Attributes in [Universal Attributes](js-components-common-attributes.md) are supported.
-## Style
+## Styles
Styles in [Universal Styles](js-components-common-styles.md) are supported.
-## Event
+## Events
Events in [Universal Events](js-components-common-events.md) are supported.
-## Method
+## Methods
In addition to the methods in [Universal Methods](js-components-common-methods.md), the following events are supported.
-
- Name
-
- Parameter
-
- Description
-
-
-
- getContext
-
- getContext ( type: '2d', attributes 6+ : { antialias: boolean } ) => CanvasRendering2dContext
-
- Obtains the canvas drawing context. The invoking methods are as follows 6+ :
- var ctx = canvas.getContext(contextType);
- var ctx = canvas.getContext(contextType, contextAttributes);
- contextType is mandatory and can be set to 2d . contextAttributes is optional and can be set only to enable or disable the anti-aliasing function. By default, the anti-aliasing function is disabled.
- The contextType objects are as follows:
- 2d : The return value is a 2D drawing object that provides specific 2D drawing operations. For details, see section CanvasRenderingContext2D .
- This API cannot be called in onInit or onReady .
-
-
- toDataURL 6+
-
- string type, number encoderOptions
-
- Generate a URL containing the image display.
-type: specifies the image format. This parameter is optional. The default format is image/png. encoderOptions: When the image format is set to image/jpeg or image/webp, the image quality can be selected from 0 to 1. If the value of this parameter is beyond the value range, the default value 0.92 is used.
-
-
-
-
+### getContext
+
+getContext\(type: '2d', options?: ContextAttrOptions\): CanvasRendering2dContext
+
+Obtains the canvas drawing context. This API cannot be called in **onInit** or **onReady**.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ type
+
+ string
+
+ Yes
+
+ The value is set to '2d' , indicating that a 2D drawing object is returned. This object can be used to draw rectangles, texts, and images on the canvas component.
+
+
+ options 6+
+
+ ContextAttrOptions
+
+ No
+
+ Whether to enable anti-aliasing. By default, anti-aliasing is disabled.
+
+
+
+
+
+ **Table 1** ContextAttrOptions
+
+
+ Name
+
+ Type
+
+ Description
+
+
+
+ antialias
+
+ boolean
+
+ Whether to enable anti-aliasing. The default value is false .
+
+
+
+
+
+- Return values
+
+
+ Type
+
+ Description
+
+
+
+ CanvasRenderingContext2D
+
+ 2D drawing object, which can be used to draw rectangles , images, and texts on the canvas component.
+
+
+
+
+
+
+### toDataURL6+
+
+toDataURL\(type?: string, quality?: number\): string
+
+Generates a URL containing image display information.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ type
+
+ string
+
+ No
+
+ Image format. The default value is image/png .
+
+
+ quality
+
+ number
+
+ No
+
+ Image quality, which ranges from 0 to 1, when the image format is image/jpeg or image/webp . If the set value is beyond the value range, the default value 0.92 is used.
+
+
+
+
+
+- Return values
+
+
+ Type
+
+ Description
+
+
+
+ string
+
+ Image URL.
+
+
+
+
+
## Example
diff --git a/en/application-dev/reference/arkui-js/js-components-canvas-canvasgradient.md b/en/application-dev/reference/arkui-js/js-components-canvas-canvasgradient.md
index 513856ee6f236eb8c74d3219684534acdc430fb4..18e1b0e45a358f9da14418fc611b2b220063f4a9 100644
--- a/en/application-dev/reference/arkui-js/js-components-canvas-canvasgradient.md
+++ b/en/application-dev/reference/arkui-js/js-components-canvas-canvasgradient.md
@@ -8,10 +8,10 @@ addColorStop\(offset: number, color: string\): void
Adds a color stop for the** CanvasGradient** object based on the specified offset and gradient color.
-- Parameter
+- Parameters
- Parameter
+ Name
Type
@@ -39,11 +39,25 @@ Adds a color stop for the** CanvasGradient** object based on the specified offs
- Example Code
```
- const gradient = ctx.createLinearGradient(0,0,100,0);
- gradient.addColorStop(0,'#00ffff');
- gradient.addColorStop(1,'#ffff00');
+
+
+
+
+
```
- ![](figures/en-us_image_0000001152610806.png)
+ ```
+ // xxx.js
+ export default {
+ handleClick() {
+ const el =this.$refs.canvas;
+ const ctx =el.getContext('2d');
+ const gradient = ctx.createLinearGradient(0,0,100,0);
+ gradient.addColorStop(0,'#00ffff');
+ gradient.addColorStop(1,'#ffff00');
+ }
+ }
+ ```
+ ![](figures/en-us_image_0000001152610806.png)
diff --git a/en/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md b/en/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md
index bed0f06aa22212c7e88c6cd93731f9f7c38593e4..e9dc8c57cd6388134b548137b98849640d768e8f 100644
--- a/en/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md
+++ b/en/application-dev/reference/arkui-js/js-components-canvas-canvasrenderingcontext2d.md
@@ -1,5 +1,6 @@
# CanvasRenderingContext2D
+
**CanvasRenderingContext2D** allows you to draw rectangles, text, images, and other objects on a canvas.
- Example
@@ -40,7 +41,7 @@
- Anti-aliasing enabled
- ![](figures/screenshot-44.png)
+ ![](figures/screenshot-8.png)
## Attributes
@@ -133,7 +134,7 @@
Text alignment mode. Available values are as follows:
left : The text is left-aligned. right : The text is right-aligned. center : The text is center-aligned. start : The text is aligned with the start bound. end : The text is aligned with the end bound.
- NOTE: In the ltr layout mode, the value start equals to left . In the rtl layout mode, the value start equals to right .
+
NOTE: In the ltr layout mode, the value start equals left . In the rtl layout mode, the value start equals right .
@@ -153,7 +154,7 @@
-
- Transparency. 0.0 : completely transparent; 1.0 : completely opaque.
+ Opacity. 0.0 : completely transparent; 1.0 : completely opaque.
lineDashOffset
@@ -225,8 +226,22 @@
### fillStyle
```
-ctx.fillStyle = '#0000ff';
-ctx.fillRect(20, 20, 150, 100);
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.fillStyle = '#0000ff';
+ ctx.fillRect(20, 20, 150, 100);
+ }
+}
```
![](figures/en-us_image_0000001166962736.png)
@@ -234,8 +249,22 @@ ctx.fillRect(20, 20, 150, 100);
### lineWidth
```
-ctx.lineWidth = 5;
-ctx.strokeRect(25, 25, 85, 105);
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.lineWidth = 5;
+ ctx.strokeRect(25, 25, 85, 105);
+ }
+}
```
![](figures/en-us_image_0000001166484430.png)
@@ -243,9 +272,23 @@ ctx.strokeRect(25, 25, 85, 105);
### strokeStyle
```
-ctx.lineWidth = 10;
-ctx.strokeStyle = '#0000ff';
-ctx.strokeRect(25, 25, 155, 105);
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.lineWidth = 10;
+ ctx.strokeStyle = '#0000ff';
+ ctx.strokeRect(25, 25, 155, 105);
+ }
+}
```
![](figures/en-us_image_0000001212124299.png)
@@ -253,12 +296,26 @@ ctx.strokeRect(25, 25, 155, 105);
### lineCap
```
-ctx.lineWidth = 8;
-ctx.beginPath();
-ctx.lineCap = 'round';
-ctx.moveTo(30, 50);
-ctx.lineTo(220, 50);
-ctx.stroke();
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.lineWidth = 8;
+ ctx.beginPath();
+ ctx.lineCap = 'round';
+ ctx.moveTo(30, 50);
+ ctx.lineTo(220, 50);
+ ctx.stroke();
+ }
+}
```
![](figures/en-us_image_0000001214837127.png)
@@ -266,13 +323,27 @@ ctx.stroke();
### lineJoin
```
-ctx.beginPath();
-ctx.lineWidth = 8;
-ctx.lineJoin = 'miter';
-ctx.moveTo(30, 30);
-ctx.lineTo(120, 60);
-ctx.lineTo(30, 110);
-ctx.stroke();
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.beginPath();
+ ctx.lineWidth = 8;
+ ctx.lineJoin = 'miter';
+ ctx.moveTo(30, 30);
+ ctx.lineTo(120, 60);
+ ctx.lineTo(30, 110);
+ ctx.stroke();
+ }
+}
```
![](figures/en-us_image_0000001214717247.png)
@@ -280,13 +351,27 @@ ctx.stroke();
### miterLimit
```
-ctx.lineWidth = 8;
-ctx.lineJoin = 'miter';
-ctx.miterLimit = 3;
-ctx.moveTo(30, 30);
-ctx.lineTo(60, 35);
-ctx.lineTo(30, 37);
-ctx.stroke();
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.lineWidth =14;
+ ctx.lineJoin = 'miter';
+ ctx.miterLimit = 3;
+ ctx.moveTo(30, 30);
+ ctx.lineTo(120, 60);
+ ctx.lineTo(30, 70);
+ ctx.stroke();
+ }
+}
```
![](figures/en-us_image_0000001167001464.png)
@@ -294,8 +379,22 @@ ctx.stroke();
### font
```
-ctx.font = '30px sans-serif';
-ctx.fillText("Hello World", 20, 60);
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.font = '30px sans-serif';
+ ctx.fillText("Hello World", 20, 60);
+ }
+}
```
![](figures/en-us_image_0000001167046832.png)
@@ -303,24 +402,38 @@ ctx.fillText("Hello World", 20, 60);
### textAlign
```
-ctx.strokeStyle = '#0000ff';
-ctx.moveTo(140, 10);
-ctx.lineTo(140, 160);
-ctx.stroke();
+
+
+
+
+```
-ctx.font = '18px sans-serif';
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.strokeStyle = '#0000ff';
+ ctx.moveTo(140, 10);
+ ctx.lineTo(140, 160);
+ ctx.stroke();
+
+ ctx.font = '18px sans-serif';
// Show the textAlign values.
-ctx.textAlign = 'start';
-ctx.fillText('textAlign=start', 140, 60);
-ctx.textAlign = 'end';
-ctx.fillText('textAlign=end', 140, 80);
-ctx.textAlign = 'left';
-ctx.fillText('textAlign=left', 140, 100);
-ctx.textAlign = 'center';
-ctx.fillText('textAlign=center',140, 120);
-ctx.textAlign = 'right';
-ctx.fillText('textAlign=right',140, 140);
+ ctx.textAlign = 'start';
+ ctx.fillText('textAlign=start', 140, 60);
+ ctx.textAlign = 'end';
+ ctx.fillText('textAlign=end', 140, 80);
+ ctx.textAlign = 'left';
+ ctx.fillText('textAlign=left', 140, 100);
+ ctx.textAlign = 'center';
+ ctx.fillText('textAlign=center',140, 120);
+ ctx.textAlign = 'right';
+ ctx.fillText('textAlign=right',140, 140);
+ }
+}
```
![](figures/en-us_image_0000001167472798.png)
@@ -328,23 +441,37 @@ ctx.fillText('textAlign=right',140, 140);
### textBaseline
```
-ctx.strokeStyle = '#0000ff';
-ctx.moveTo(0, 120);
-ctx.lineTo(400, 120);
-ctx.stroke();
+
+
+
+
+```
-ctx.font = '20px sans-serif';
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.strokeStyle = '#0000ff';
+ ctx.moveTo(0, 120);
+ ctx.lineTo(400, 120);
+ ctx.stroke();
-ctx.textBaseline = 'top';
-ctx.fillText('Top', 10, 120);
-ctx.textBaseline = 'bottom';
-ctx.fillText('Bottom', 55, 120);
-ctx.textBaseline = 'middle';
-ctx.fillText('Middle', 125, 120);
-ctx.textBaseline = 'alphabetic';
-ctx.fillText('Alphabetic', 195, 120);
-ctx.textBaseline = 'hanging';
-ctx.fillText('Hanging', 295, 120);
+ ctx.font = '20px sans-serif';
+
+ ctx.textBaseline = 'top';
+ ctx.fillText('Top', 10, 120);
+ ctx.textBaseline = 'bottom';
+ ctx.fillText('Bottom', 55, 120);
+ ctx.textBaseline = 'middle';
+ ctx.fillText('Middle', 125, 120);
+ ctx.textBaseline = 'alphabetic';
+ ctx.fillText('Alphabetic', 195, 120);
+ ctx.textBaseline = 'hanging';
+ ctx.fillText('Hanging', 295, 120);
+ }
+}
```
![](figures/en-us_image_0000001169315920.png)
@@ -352,11 +479,26 @@ ctx.fillText('Hanging', 295, 120);
### globalAlpha
```
-ctx.fillStyle = 'rgb(255,0,0)';
-ctx.fillRect(0, 0, 50, 50);
-ctx.globalAlpha = 0.4;
-ctx.fillStyle = 'rgb(0,0,255)';
-ctx.fillRect(50, 50, 50, 50);
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.fillRect(0, 0, 50, 50);
+ ctx.globalAlpha = 0.4;
+ ctx.fillStyle = 'rgb(0,0,255)';
+ ctx.fillRect(50, 50, 50, 50);
+
+ }
+}
```
![](figures/en-us_image_0000001167953648.png)
@@ -364,17 +506,31 @@ ctx.fillRect(50, 50, 50, 50);
### lineDashOffset
```
-ctx.arc(100, 75, 50, 0, 6.28);
-ctx.setLineDash([10,20]);
-ctx.lineDashOffset = 10.0;
-ctx.stroke();
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.arc(100, 75, 50, 0, 6.28);
+ ctx.setLineDash([10,20]);
+ ctx.lineDashOffset = 10.0;
+ ctx.stroke();
+ }
+}
```
![](figures/en-us_image_0000001167950468.png)
### globalCompositeOperation
-- Defines a **globalCompositeOperation** object.
+- Enumerates the operation types.
Value
@@ -445,17 +601,31 @@ ctx.stroke();
- Example
```
- ctx.fillStyle = 'rgb(255,0,0)';
- ctx.fillRect(20, 20, 50, 50);
- ctx.globalCompositeOperation = 'source-over';
- ctx.fillStyle = 'rgb(0,0,255)';
- ctx.fillRect(50, 50, 50, 50);
- // Start drawing second example
- ctx.fillStyle = 'rgb(255,0,0)';
- ctx.fillRect(120, 20, 50, 50);
- ctx.globalCompositeOperation = 'destination-over';
- ctx.fillStyle = 'rgb(0,0,255)';
- ctx.fillRect(150, 50, 50, 50);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.fillRect(20, 20, 50, 50);
+ ctx.globalCompositeOperation = 'source-over';
+ ctx.fillStyle = 'rgb(0,0,255)';
+ ctx.fillRect(50, 50, 50, 50);
+ // Start drawing second example
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.fillRect(120, 20, 50, 50);
+ ctx.globalCompositeOperation = 'destination-over';
+ ctx.fillStyle = 'rgb(0,0,255)';
+ ctx.fillRect(150, 50, 50, 50);
+ }
+ }
```
![](figures/en-us_image_0000001213192781.png)
@@ -466,10 +636,24 @@ ctx.stroke();
### shadowBlur
```
-ctx.shadowBlur = 30;
-ctx.shadowColor = 'rgb(0,0,0)';
-ctx.fillStyle = 'rgb(255,0,0)';
-ctx.fillRect(20, 20, 100, 80);
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.shadowBlur = 30;
+ ctx.shadowColor = 'rgb(0,0,0)';
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.fillRect(20, 20, 100, 80);
+ }
+}
```
![](figures/en-us_image_0000001168111514.png)
@@ -477,10 +661,24 @@ ctx.fillRect(20, 20, 100, 80);
### shadowColor
```
-ctx.shadowBlur = 30;
-ctx.shadowColor = 'rgb(0,0,255)';
-ctx.fillStyle = 'rgb(255,0,0)';
-ctx.fillRect(30, 30, 100, 100);
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.shadowBlur = 30;
+ ctx.shadowColor = 'rgb(0,0,255)';
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.fillRect(30, 30, 100, 100);
+ }
+}
```
![](figures/en-us_image_0000001168111610.png)
@@ -488,11 +686,25 @@ ctx.fillRect(30, 30, 100, 100);
### shadowOffsetX
```
-ctx.shadowBlur = 10;
-ctx.shadowOffsetX = 20;
-ctx.shadowColor = 'rgb(0,0,0)';
-ctx.fillStyle = 'rgb(255,0,0)';
-ctx.fillRect(20, 20, 100, 80);
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.shadowBlur = 10;
+ ctx.shadowOffsetX = 20;
+ ctx.shadowColor = 'rgb(0,0,0)';
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.fillRect(20, 20, 100, 80);
+ }
+}
```
![](figures/en-us_image_0000001167631876.png)
@@ -500,11 +712,25 @@ ctx.fillRect(20, 20, 100, 80);
### shadowOffsetY
```
-ctx.shadowBlur = 10;
-ctx.shadowOffsetY = 20;
-ctx.shadowColor = 'rgb(0,0,0)';
-ctx.fillStyle = 'rgb(255,0,0)';
-ctx.fillRect(30, 30, 100, 100);
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.shadowBlur = 10;
+ ctx.shadowOffsetY = 20;
+ ctx.shadowColor = 'rgb(0,0,0)';
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.fillRect(30, 30, 100, 100);
+ }
+}
```
![](figures/en-us_image_0000001213193285.png)
@@ -512,12 +738,26 @@ ctx.fillRect(30, 30, 100, 100);
### imageSmoothingEnabled6+
```
-var img = new Image();
-img.src = 'common/image/huawei.jpg';
-img.onload = function() {
- ctx.imageSmoothingEnabled = false;
- ctx.drawImage(img, 0, 0, 400, 200);
-};
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var img = new Image();
+ img.src = 'common/image/example.jpg';
+ img.onload = function() {
+ ctx.imageSmoothingEnabled = false;
+ ctx.drawImage(img, 0, 0, 400, 200);
+ };
+ }
+}
```
![](figures/smoothoff.png)
@@ -530,7 +770,7 @@ fillRect\(x: number, y: number, width:number, height: number\): void
Fills a rectangle on the canvas.
-- Parameter
+- Parameters
Name
@@ -559,7 +799,7 @@ Fills a rectangle on the canvas.
number
- Width of the rectangle
+ Width of the rectangle.
height
@@ -575,7 +815,21 @@ Fills a rectangle on the canvas.
- Example
```
- ctx.fillRect(20, 20, 200, 150);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.fillRect(20, 20, 200, 150);
+ }
+ }
```
![](figures/en-us_image_0000001214811029.png)
@@ -587,7 +841,7 @@ clearRect\(x: number, y: number, width:number, height: number\): void
Clears the content in a rectangle on the canvas.
-- Parameter
+- Parameters
Name
@@ -616,7 +870,7 @@ Clears the content in a rectangle on the canvas.
number
- Width of the rectangle
+ Width of the rectangle.
height
@@ -632,9 +886,23 @@ Clears the content in a rectangle on the canvas.
- Example
```
- ctx.fillStyle = 'rgb(0,0,255)';
- ctx.fillRect(0, 0, 400, 200);
- ctx.clearRect(20, 20, 150, 100);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.fillStyle = 'rgb(0,0,255)';
+ ctx.fillRect(0, 0, 400, 200);
+ ctx.clearRect(20, 20, 150, 100);
+ }
+ }
```
![](figures/en-us_image_0000001214619417.png)
@@ -646,7 +914,7 @@ strokeRect\(x: number, y: number, width:number, height: number\): void
Draws a rectangle stroke on the canvas.
-- Parameter
+- Parameters
Name
@@ -675,7 +943,7 @@ Draws a rectangle stroke on the canvas.
number
- Width of the rectangle
+ Width of the rectangle.
height
@@ -691,7 +959,21 @@ Draws a rectangle stroke on the canvas.
- Example
```
- ctx.strokeRect(30, 30, 200, 150);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.strokeRect(30, 30, 200, 150);
+ }
+ }
```
![](figures/en-us_image_0000001214822091.png)
@@ -703,7 +985,7 @@ fillText\(text: string, x: number, y: number\): void
Draws filled text on the canvas.
-- Parameter
+- Parameters
Name
@@ -741,8 +1023,22 @@ Draws filled text on the canvas.
- Example
```
- ctx.font = '35px sans-serif';
- ctx.fillText("Hello World!", 20, 60);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.font = '35px sans-serif';
+ ctx.fillText("Hello World!", 10, 60);
+ }
+ }
```
![](figures/en-us_image_0000001214469787.png)
@@ -754,7 +1050,7 @@ strokeText\(text: string, x: number, y: number\): void
Draws a text stroke on the canvas.
-- Parameter
+- Parameters
Name
@@ -792,8 +1088,22 @@ Draws a text stroke on the canvas.
- Example
```
- ctx.font = '25px sans-serif';
- ctx.strokeText("Hello World!", 20, 60);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.font = '25px sans-serif';
+ ctx.strokeText("Hello World!", 10, 60);
+ }
+ }
```
![](figures/en-us_image_0000001214460669.png)
@@ -805,7 +1115,7 @@ measureText\(text: string\): TextMetrics
Returns a **TextMetrics** object used to obtain the width of specified text.
-- Parameter
+- Parameters
Name
@@ -846,10 +1156,24 @@ Returns a **TextMetrics** object used to obtain the width of specified text.
- Example
```
- ctx.font = '25px sans-serif';
- var txt = 'Hello World';
- ctx.fillText("width:" + ctx.measureText(txt).width, 20, 60);
- ctx.fillText(txt, 20, 110);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.font = '20px sans-serif';
+ var txt = 'Hello World';
+ ctx.fillText("width:" + ctx.measureText(txt).width, 20, 60);
+ ctx.fillText(txt, 20, 110);
+ }
+ }
```
![](figures/en-us_image_0000001169142476.png)
@@ -864,13 +1188,28 @@ Draws a stroke.
- Example
```
- ctx.moveTo(25, 25);
- ctx.lineTo(25, 105);
- ctx.strokeStyle = 'rgb(0,0,255)';
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.moveTo(25, 25);
+ ctx.lineTo(25, 250);
+ ctx.lineWidth = '6';
+ ctx.strokeStyle = 'rgb(0,0,255)';
+ ctx.stroke();
+ }
+ }
```
- ![](figures/en-us_image_0000001169309930.png)
+ ![](figures/en-us_image_0000001236697937.png)
### beginPath
@@ -882,12 +1221,26 @@ Creates a drawing path.
- Example
```
- ctx.beginPath();
- ctx.lineWidth = '6';
- ctx.strokeStyle = '#0000ff';
- ctx.moveTo(15, 80);
- ctx.lineTo(280, 160);
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.beginPath();
+ ctx.lineWidth = '6';
+ ctx.strokeStyle = '#0000ff';
+ ctx.moveTo(15, 80);
+ ctx.lineTo(280, 80);
+ ctx.stroke();
+ }
+ }
```
![](figures/en-us_image_0000001214629745.png)
@@ -899,7 +1252,7 @@ moveTo\(x: number, y: number\): void
Moves a drawing path to a target position on the canvas.
-- Parameter
+- Parameters
Name
@@ -930,10 +1283,24 @@ Moves a drawing path to a target position on the canvas.
- Example
```
- ctx.beginPath();
- ctx.moveTo(10, 10);
- ctx.lineTo(280, 160);
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.beginPath();
+ ctx.moveTo(10, 10);
+ ctx.lineTo(280, 160);
+ ctx.stroke();
+ }
+ }
```
![](figures/en-us_image_0000001169309948.png)
@@ -945,7 +1312,7 @@ lineTo\(x: number, y: number\): void
Connects the current point to a target position using a straight line.
-- Parameter
+- Parameters
Name
@@ -976,10 +1343,24 @@ Connects the current point to a target position using a straight line.
- Example
```
- ctx.beginPath();
- ctx.moveTo(10, 10);
- ctx.lineTo(280, 160);
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.beginPath();
+ ctx.moveTo(10, 10);
+ ctx.lineTo(280, 160);
+ ctx.stroke();
+ }
+ }
```
![](figures/en-us_image_0000001169469914.png)
@@ -994,12 +1375,26 @@ Draws a closed path.
- Example
```
- ctx.beginPath();
- ctx.moveTo(30, 30);
- ctx.lineTo(110, 30);
- ctx.lineTo(70, 90);
- ctx.closePath();
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.beginPath();
+ ctx.moveTo(30, 30);
+ ctx.lineTo(110, 30);
+ ctx.lineTo(70, 90);
+ ctx.closePath();
+ ctx.stroke();
+ }
+ }
```
![](figures/en-us_image_0000001169151508.png)
@@ -1011,7 +1406,7 @@ createPattern\(image: Image, repetition: string\): Object
Creates a pattern for image filling based on a specified source image and repetition mode.
-- Parameter
+- Parameters
Name
@@ -1059,9 +1454,25 @@ Creates a pattern for image filling based on a specified source image and repeti
- Example
```
- var pat = ctx.createPattern(img, 'repeat');
- ctx.fillStyle = pat;
- ctx.fillRect(0, 0, 20, 20);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var img = new Image();
+ img.src = 'common/images/example.jpg';
+ var pat = ctx.createPattern(img, 'repeat');
+ ctx.fillStyle = pat;
+ ctx.fillRect(0, 0, 20, 20);
+ }
+ }
```
![](figures/en-us_image_0000001169301188.png)
@@ -1073,7 +1484,7 @@ bezierCurveTo\(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number
Draws a cubic bezier curve on the canvas.
-- Parameter
+- Parameters
Name
@@ -1132,10 +1543,24 @@ Draws a cubic bezier curve on the canvas.
- Example
```
- ctx.beginPath();
- ctx.moveTo(10, 10);
- ctx.bezierCurveTo(20, 100, 200, 100, 200, 20);
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.beginPath();
+ ctx.moveTo(10, 10);
+ ctx.bezierCurveTo(20, 100, 200, 100, 200, 20);
+ ctx.stroke();
+ }
+ }
```
![](figures/en-us_image_0000001214621177.png)
@@ -1147,7 +1572,7 @@ quadraticCurveTo\(cpx: number, cpy: number, x: number, y: number\): void
Draws a quadratic curve on the canvas.
-- Parameter
+- Parameters
Name
@@ -1192,10 +1617,24 @@ Draws a quadratic curve on the canvas.
- Example
```
- ctx.beginPath();
- ctx.moveTo(20, 20);
- ctx.quadraticCurveTo(100, 100, 200, 20);
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.beginPath();
+ ctx.moveTo(20, 20);
+ ctx.quadraticCurveTo(100, 100, 200, 20);
+ ctx.stroke();
+ }
+ }
```
![](figures/en-us_image_0000001169461910.png)
@@ -1207,7 +1646,7 @@ arc\(x: number, y: number, radius: number, startAngle: number, endAngle: number,
Draws an arc on the canvas.
-- Parameter
+- Parameters
Name
@@ -1266,9 +1705,23 @@ Draws an arc on the canvas.
- Example
```
- ctx.beginPath();
- ctx.arc(100, 75, 50, 0, 6.28);
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.beginPath();
+ ctx.arc(100, 75, 50, 0, 6.28);
+ ctx.stroke();
+ }
+ }
```
![](figures/en-us_image_0000001169470288.png)
@@ -1280,7 +1733,7 @@ arcTo\(x1: number, y1: number, x2: number, y2: number, radius: number\): void
Draws an arc based on the radius and points on the arc.
-- Parameter
+- Parameters
Name
@@ -1332,9 +1785,23 @@ Draws an arc based on the radius and points on the arc.
- Example
```
- ctx.moveTo(100, 20);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.moveTo(100, 20);
ctx.arcTo(150, 20, 150, 70, 50); // Create an arc.
- ctx.stroke();
+ ctx.stroke();
+ }
+ }
```
![](figures/en-us_image_0000001169143586.png)
@@ -1346,7 +1813,7 @@ ellipse\(x: number, y: number, radiusX: number, radiusY: number, rotation: numbe
Draws an ellipse in the specified rectangular region.
-- Parameter
+- Parameters
Name
@@ -1361,28 +1828,28 @@ Draws an ellipse in the specified rectangular region.
number
- X coordinate of the ellipse center
+ X-coordinate of the ellipse center
y
number
- Y coordinate of the ellipse center
+ Y-coordinate of the ellipse center
radiusX
number
- Ellipse radius on the x axis
+ Ellipse radius on the x-axis.
radiusY
number
- Ellipse radius on the y axis
+ Ellipse radius on the y-axis.
rotation
@@ -1419,9 +1886,23 @@ Draws an ellipse in the specified rectangular region.
- Example
```
- ctx.beginPath();
- ctx.ellipse(200, 200, 50, 100, Math.PI * 0.25, Math.PI * 0.5, Math.PI, 1);
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.beginPath();
+ ctx.ellipse(200, 200, 50, 100, Math.PI * 0.25, Math.PI * 0.5, Math.PI, 1);
+ ctx.stroke();
+ }
+ }
```
![](figures/ellipse.png)
@@ -1433,7 +1914,7 @@ rect\(x: number, y: number, width: number, height: number\): void
Creates a rectangle.
-- Parameter
+- Parameters
Name
@@ -1462,7 +1943,7 @@ Creates a rectangle.
number
- Width of the rectangle
+ Width of the rectangle.
height
@@ -1478,8 +1959,22 @@ Creates a rectangle.
- Example
```
- ctx.rect(20, 20, 100, 100); // Create a 100*100 rectangle at (20, 20)
- ctx.stroke(); // Draw it
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.rect(20, 20, 100, 100); // Create a 100*100 rectangle at (20, 20)
+ ctx.stroke(); // Draw it
+ }
+ }
```
![](figures/en-us_image_0000001214630783.png)
@@ -1494,8 +1989,22 @@ Fills the area inside a closed path.
- Example
```
- ctx.rect(20, 20, 100, 100); // Create a 100 x 100 rectangle at (20, 20).
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.rect(20, 20, 100, 100); // Create a 100*100 rectangle at (20, 20).
ctx.fill(); // Fill the rectangle using default settings.
+ }
+ }
```
![](figures/en-us_image_0000001214703717.png)
@@ -1510,12 +2019,26 @@ Sets the current path to a clipping path.
- Example
```
- ctx.rect(0, 0, 200, 200);
- ctx.stroke();
- ctx.clip();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.rect(0, 0, 200, 200);
+ ctx.stroke();
+ ctx.clip();
// Clip a rectangle and fill it with red paint.
- ctx.fillStyle = "rgb(255,0,0)";
- ctx.fillRect(0, 0, 150, 150);
+ ctx.fillStyle = "rgb(255,0,0)";
+ ctx.fillRect(0, 0, 150, 150);
+ }
+ }
```
![](figures/en-us_image_0000001169303414.png)
@@ -1527,7 +2050,7 @@ rotate\(rotate: number\): void
Rotates a canvas clockwise around its coordinate axes.
-- Parameter
+- Parameters
Name
@@ -1551,8 +2074,22 @@ Rotates a canvas clockwise around its coordinate axes.
- Example
```
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
ctx.rotate(45 * Math.PI / 180); // Rotate the rectangle 45 degrees.
- ctx.fillRect(70, 20, 50, 50);
+ ctx.fillRect(70, 20, 50, 50);
+ }
+ }
```
![](figures/en-us_image_0000001169463368.png)
@@ -1564,7 +2101,7 @@ scale\(x: number, y: number\): void
Scales a canvas based on scaling factors.
-- Parameter
+- Parameters
Name
@@ -1595,9 +2132,23 @@ Scales a canvas based on scaling factors.
- Example
```
- ctx.strokeRect(10, 10, 25, 25);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.strokeRect(10, 10, 25, 25);
ctx.scale(2, 2);// Set a 200% scale factor for the rectangle.
- ctx.strokeRect(10, 10, 25, 25);
+ ctx.strokeRect(10, 10, 25, 25);
+ }
+ }
```
![](figures/en-us_image_0000001214463281.png)
@@ -1614,7 +2165,7 @@ Defines a transformation matrix. To transform a graph, you only need to set para
>- x' = scaleX \* x + skewY \* y + translateX
>- y' = skewX \* x + scaleY \* y + translateY
-- Parameter
+- Parameters
Name
@@ -1673,14 +2224,28 @@ Defines a transformation matrix. To transform a graph, you only need to set para
- Example
```
- ctx.fillStyle = 'rgb(0,0,0)';
- ctx.fillRect(0, 0, 100, 100)
- ctx.transform(1, 0.5, -0.5, 1, 10, 10);
- ctx.fillStyle = 'rgb(255,0,0)';
- ctx.fillRect(0, 0, 100, 100);
- ctx.transform(1, 0.5, -0.5, 1, 10, 10);
- ctx.fillStyle = 'rgb(0,0,255)';
- ctx.fillRect(0, 0, 100, 100);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.fillStyle = 'rgb(0,0,0)';
+ ctx.fillRect(0, 0, 100, 100)
+ ctx.transform(1, 0.5, -0.5, 1, 10, 10);
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.fillRect(0, 0, 100, 100);
+ ctx.transform(1, 0.5, -0.5, 1, 10, 10);
+ ctx.fillStyle = 'rgb(0,0,255)';
+ ctx.fillRect(0, 0, 100, 100);
+ }
+ }
```
![](figures/en-us_image_0000001214623227.png)
@@ -1751,11 +2316,25 @@ Resets the existing transformation matrix and creates a new transformation matri
- Example
```
- ctx.fillStyle = 'rgb(255,0,0)';
- ctx.fillRect(0, 0, 100, 100)
- ctx.setTransform(1,0.5, -0.5, 1, 10, 10);
- ctx.fillStyle = 'rgb(0,0,255)';
- ctx.fillRect(0, 0, 100, 100);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.fillStyle = 'rgb(255,0,0)';
+ ctx.fillRect(0, 0, 100, 100)
+ ctx.setTransform(1,0.5, -0.5, 1, 10, 10);
+ ctx.fillStyle = 'rgb(0,0,255)';
+ ctx.fillRect(0, 0, 100, 100);
+ }
+ }
```
![](figures/en-us_image_0000001168984880.png)
@@ -1767,7 +2346,7 @@ translate\(x: number, y: number\): void
Moves the origin of the coordinate system.
-- Parameter
+- Parameters
Name
@@ -1798,9 +2377,23 @@ Moves the origin of the coordinate system.
- Example
```
- ctx.fillRect(10, 10, 50, 50);
- ctx.translate(70, 70);
- ctx.fillRect(10, 10, 50, 50);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.fillRect(10, 10, 50, 50);
+ ctx.translate(70, 70);
+ ctx.fillRect(10, 10, 50, 50);
+ }
+ }
```
![](figures/en-us_image_0000001169144864.png)
@@ -1812,7 +2405,7 @@ createPath2D\(path: Path2D, cmds: string\): Path2D
Creates a **Path2D** object.
-- Parameter
+- Parameters
Name
@@ -1847,16 +2440,30 @@ Creates a **Path2D** object.
- Example
```
- var path1 = ctx.createPath2D();
- path1.moveTo(100, 100);
- path1.lineTo(200, 100);
- path1.lineTo(100, 200);
- path1.closePath();
- ctx.stroke(path1);
- var path2 = ctx.createPath2D("M150 150 L50 250 L250 250 Z");
- ctx.stroke(path2);
- var path3 = ctx.createPath2D(path2);
- ctx.stroke(path3);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path1 = ctx.createPath2D();
+ path1.moveTo(100, 100);
+ path1.lineTo(200, 100);
+ path1.lineTo(100, 200);
+ path1.closePath();
+ ctx.stroke(path1);
+ var path2 = ctx.createPath2D("M150 150 L50 250 L250 250 Z");
+ ctx.stroke(path2);
+ var path3 = ctx.createPath2D(path2);
+ ctx.stroke(path3);
+ }
+ }
```
![](figures/en-us_image_0000001214824709.png)
@@ -1868,7 +2475,7 @@ drawImage\(image: Image, sx: number, sy: number, sWidth: number, sHeight: number
Draws an image.
-- Parameter
+- Parameters
Name
@@ -1948,11 +2555,23 @@ Draws an image.
- Example
```
- var test = this.$element('drawImage');
- var ctx = test.getContext('2d');
- var img = new Image();
- img.src = 'common/image/test.jpg';
- ctx.drawImage(img, 50, 80, 80, 80);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ var test = this.$element('drawImage');
+ var ctx = test.getContext('2d');
+ var img = new Image();
+ img.src = 'common/image/test.jpg';
+ ctx.drawImage(img, 50, 80, 80, 80);
+ }
+ }
```
![](figures/en-us_image_0000001214704759.png)
@@ -1967,7 +2586,21 @@ Restores the saved drawing context.
- Example
```
- ctx.restore();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.restore();
+ }
+ }
```
@@ -1980,7 +2613,21 @@ Saves the current drawing context.
- Example
```
- ctx.save();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.save();
+ }
+ }
```
@@ -1990,7 +2637,7 @@ createLinearGradient\(x0: number, y0: number, x1: number, y1: number\): Object
Creates a linear gradient. A CanvasGradient object is returned. For details, see [CanvasGradient](js-components-canvas-canvasgradient.md).
-- Parameter
+- Parameters
Name
@@ -2005,34 +2652,34 @@ Creates a linear gradient. A CanvasGradient object is returned. For details, see
number
- X coordinate of the start point
+ X-coordinate of the start point.
y0
number
- Y coordinate of the start point
+ Y-coordinate of the start point.
x1
number
- X coordinate of the end point
+ X-coordinate of the end point.
y1
number
- Y coordinate of the end point
+ Y-coordinate of the end point.
-- Return Value
+- Return values
Type
@@ -2053,8 +2700,10 @@ Creates a linear gradient. A CanvasGradient object is returned. For details, see
```
-
-
+
+
+
+
```
```
@@ -2085,7 +2734,7 @@ createRadialGradient\(x0: number, y0: number, r0: number, x1: number, y1: number
Creates a radial gradient and returns a **CanvasGradient** object.
-- Parameter
+- Parameters
Name
@@ -2100,14 +2749,14 @@ Creates a radial gradient and returns a **CanvasGradient** object.
number
- X coordinate of the start point
+ X-coordinate of the start point.
y0
number
- Y coordinate of the center of the start circle
+ Y-coordinate of the center of the start circle.
r0
@@ -2121,14 +2770,14 @@ Creates a radial gradient and returns a **CanvasGradient** object.
number
- X coordinate of the center of the end circle
+ X-coordinate of the center of the end circle.
y1
number
- Y coordinate of the center of the end circle
+ Y-coordinate of the center of the end circle.
r1
@@ -2152,7 +2801,7 @@ Creates a radial gradient and returns a **CanvasGradient** object.
Object
- Returns the created CanvasGradient object.
+ Returns the created CanvasGradient object.
@@ -2162,8 +2811,10 @@ Creates a radial gradient and returns a **CanvasGradient** object.
```
-
-
+
+
+
+
```
```
@@ -2194,7 +2845,7 @@ createImageData\(width: number, height: number, imageData: Object\): Object
Creates an **ImageData** object. For details, see [ImageData](js-components-canvas-imagedata.md).
-- Parameter
+- Parameters
Name
@@ -2249,8 +2900,22 @@ Creates an **ImageData** object. For details, see [ImageData](js-components-c
- Example
```
- imageData = ctx.createImageData(50, 100); // Create ImageData with 50px width and 100px height
- newImageData = ctx.createImageData(imageData); // Create ImageData using the input imageData
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ imageData = ctx.createImageData(50, 100); // Create ImageData with 50px width and 100px height
+ newImageData = ctx.createImageData(imageData); // Create ImageData using the input imageData
+ }
+ }
```
@@ -2260,7 +2925,7 @@ getImageData\(sx: number, sy: number, sw: number, sh: number\): Object
Creates an **ImageData** object with pixels in the specified area on the canvas.
-- Parameter
+- Parameters
Name
@@ -2275,14 +2940,14 @@ Creates an **ImageData** object with pixels in the specified area on the canva
number
- X-coordinate of the upper left corner of the output area
+ X coordinate of the upper left corner of the output area
sy
number
- Y-coordinate of the upper left corner of the output area
+ Y coordinate of the upper left corner of the output area
sw
@@ -2322,9 +2987,21 @@ Creates an **ImageData** object with pixels in the specified area on the canva
- Example
```
- var test = this.$element('getImageData');
- var ctx = test.getContext('2d');
- var imageData = ctx.getImageData(0, 0, 280, 300);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ var test = this.$element('getImageData')
+ var ctx = test.getContext('2d');
+ var imageData = ctx.getImageData(0, 0, 280, 300);
+ }
+ }
```
@@ -2334,7 +3011,7 @@ putImageData\(imageData: Object, dx: number, dy: number, dirtyX: number, dirtyY:
Puts the **ImageData** onto a rectangular area on the canvas.
-- Parameter
+- Parameters
Name
@@ -2400,16 +3077,28 @@ Puts the **ImageData** onto a rectangular area on the canvas.
- Example
```
- var test = this.$element('putImageData');
- var ctx = test.getContext('2d');
- var imgData = ctx.createImageData(100, 100);
- for (var i = 0; i < imgData.data.length; i += 4) {
- imgData.data[i + 0] = 255;
- imgData.data[i + 1] = 0;
- imgData.data[i + 2] = 0;
- imgData.data[i + 3] = 255;
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ var test = this.$element('getImageData')
+ var ctx = test.getContext('2d');
+ var imgData = ctx.createImageData(100, 100);
+ for (var i = 0; i < imgData.data.length; i += 4) {
+ imgData.data[i + 0] = 255;
+ imgData.data[i + 1] = 0;
+ imgData.data[i + 2] = 0;
+ imgData.data[i + 3] = 255;
+ }
+ ctx.putImageData(imgData, 10, 10);
+ }
}
- ctx.putImageData(imgData, 10, 10);
```
![](figures/en-us_image_0000001214463283.png)
@@ -2421,7 +3110,7 @@ setLineDash\(segments: Array\): void
Sets the dash line style.
-- Parameter
+- Parameters
Name
@@ -2445,9 +3134,23 @@ Sets the dash line style.
- Example
```
- ctx.arc(100, 75, 50, 0, 6.28);
- ctx.setLineDash([10,20]);
- ctx.stroke();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.arc(100, 75, 50, 0, 6.28);
+ ctx.setLineDash([10,20]);
+ ctx.stroke();
+ }
+ }
```
![](figures/en-us_image_0000001214623229.png)
@@ -2470,7 +3173,7 @@ Obtains the dash line style.
Array
- Interval of alternate line segments and the length of spacing
+ Interval of alternate line segments and the length of spacing.
@@ -2479,7 +3182,21 @@ Obtains the dash line style.
- Example
```
- var info = ctx.getLineDash();
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var info = ctx.getLineDash();
+ }
+ }
```
@@ -2489,7 +3206,7 @@ transferFromImageBitmap\(bitmap: ImageBitmap\): void
Displays the specified **ImageBitmap** object.
-- Parameter
+- Parameters
Name
@@ -2513,15 +3230,28 @@ Displays the specified **ImageBitmap** object.
- Example
```
- var canvas = this.$refs.canvasId.getContext('2d');
- var offscreen = new OffscreenCanvas(500,500);
- var offscreenCanvasCtx = offscreen.getContext("2d");
- offscreenCanvasCtx.fillRect(0, 0, 200, 200);
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var canvas = this.$refs.canvas.getContext('2d');
+ var offscreen = new OffscreenCanvas(500,500);
+ var offscreenCanvasCtx = offscreen.getContext("2d");
+ offscreenCanvasCtx.fillRect(0, 0, 200, 200);
- var bitmap = offscreen.transferToImageBitmap();
- canvas.transferFromImageBitmap(bitmap);
+ var bitmap = offscreen.transferToImageBitmap();
+ canvas.transferFromImageBitmap(bitmap);
+ }
+ }
```
![](figures/en-us_image_0000001168984882.png)
-
diff --git a/en/application-dev/reference/arkui-js/js-components-canvas-image.md b/en/application-dev/reference/arkui-js/js-components-canvas-image.md
index 46dce7fc255b8cb8c25d13aafca8807658e6cb74..8ad046dea4f04309fca88e860adf17f3a561d6ad 100644
--- a/en/application-dev/reference/arkui-js/js-components-canvas-image.md
+++ b/en/application-dev/reference/arkui-js/js-components-canvas-image.md
@@ -2,10 +2,10 @@
**Image** allows you to add an image.
-## Attribute
+## Attributes
- Attribute
+ Name
Type
@@ -25,7 +25,7 @@
Yes
- Image resource path
+ Image resource path.
width
@@ -36,7 +36,7 @@
No
- Image width
+ Image width.
height
@@ -47,7 +47,7 @@
No
- Image height
+ Image height.
onload
@@ -78,17 +78,30 @@
## Example
```
-var ctx = this.$element('drawImage').getContext('2d');
-var img = new Image();
-img.src = 'common/images/huawei.jpg';
-img.onload = function() {
- console.log('Image load success');
- ctx.drawImage(img, 0, 0, 360, 250);
-};
-img.onerror = function() {
- console.log('Image load fail');
-};
+
+
+
+
```
-![](figures/en-us_image_0000001198530395.png)
+```
+//xxx.js
+export default {
+ onShow(){
+ const el =this.$refs.canvas
+ var ctx = this.$element('drawImage').getContext('2d');
+ var img = new Image();
+ img.src = 'common/images/example.jpg';
+ img.onload = function() {
+ console.log('Image load success');
+ ctx.drawImage(img, 0, 0, 360, 250);
+ };
+ img.onerror = function() {
+ console.log('Image load fail');
+ };
+ }
+}
+```
+
+![](figures/1-9.png)
diff --git a/en/application-dev/reference/arkui-js/js-components-canvas-imagebitmap.md b/en/application-dev/reference/arkui-js/js-components-canvas-imagebitmap.md
index 10d8bceff27ac5457b9e2003781b87b27d0dff8f..b8fa0a4cf0f4a21c43b61b6de94bea3191241cd0 100644
--- a/en/application-dev/reference/arkui-js/js-components-canvas-imagebitmap.md
+++ b/en/application-dev/reference/arkui-js/js-components-canvas-imagebitmap.md
@@ -1,9 +1,9 @@
# ImageBitmap
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>**ImageBitmap** is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-The **ImageBitmap** object is generated by the **transferToImageBitmap\(\)** method of the **OffscreenCanvas** object and stores the pixel data rendered by the offscreen canvas.
+The **ImageBitmap** object is generated by the **transferToImageBitmap\(\)** method of the **OffscreenCanvas** and stores the pixel data rendered on the **OffscreenCanvas**.
## Attributes
@@ -32,4 +32,3 @@ The **ImageBitmap** object is generated by the **transferToImageBitmap\(\)**
-
diff --git a/en/application-dev/reference/arkui-js/js-components-canvas-imagedata.md b/en/application-dev/reference/arkui-js/js-components-canvas-imagedata.md
index ca3d42fa56432c1ca77b46cb32b5da9f3dac665d..5be0cc8d984b5eb433c4fe476d18f83a7b857283 100644
--- a/en/application-dev/reference/arkui-js/js-components-canvas-imagedata.md
+++ b/en/application-dev/reference/arkui-js/js-components-canvas-imagedata.md
@@ -37,3 +37,29 @@
+## Example
+
+```
+
+
+
+
+```
+
+```
+//xxx.js
+import prompt from '@system.prompt';
+export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ ctx.fillRect(0,0,200,200)
+ var imageData = ctx.createImageData(1,1)
+ prompt.showToast({
+ message:imageData,
+ duration:5000
+ })
+ }
+}
+```
+
diff --git a/en/application-dev/reference/arkui-js/js-components-canvas-offscreencanvas.md b/en/application-dev/reference/arkui-js/js-components-canvas-offscreencanvas.md
index c23d6a59618fc4325cd1d8c62a0bf54743af55dd..ff809fb5f91c182738670f03821508e6de31e301 100644
--- a/en/application-dev/reference/arkui-js/js-components-canvas-offscreencanvas.md
+++ b/en/application-dev/reference/arkui-js/js-components-canvas-offscreencanvas.md
@@ -1,9 +1,9 @@
# OffscreenCanvas
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>**OffscreenCanvas** is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-Defines a canvas object that can be rendered off the screen.
+**OffscreenCanvas** defines a canvas object that can be rendered off the screen.
## Attributes
@@ -20,14 +20,14 @@ Defines a canvas object that can be rendered off the screen.
number
- Width of the offscreen canvas object.
+ Width of the OffscreenCanvas object.
height
number
- Height of the offscreen canvas object.
+ Height of the OffscreenCanvas object.
@@ -35,57 +35,171 @@ Defines a canvas object that can be rendered off the screen.
## Methods
-
- Name
-
- Parameter
-
- Description
-
-
-
- getContext
-
- contextId: "2d", options?: CanvasRenderingContext2DSettings
-
- The invoking methods are as follows:
- var ctx = canvas.getContext(contextId);
- var ctx = canvas.getContext(contextId, options);
- The contextId parameter is mandatory. Currently, only the value 2d is supported. The options parameter is optional and is not supported currently.
- Obtains the context for drawing on an offscreen canvas. The parameter can be set only to 2d . The return value is a 2D drawing object that provides specific 2D drawing operations. For details, see OffscreenCanvasRenderingContext2D .
-
-
- toDataURL
-
- type?: string, quality?: number
-
- Generates a URL containing image display information.
- type : specifies the image format. This parameter is optional. The default value is image/png . quality : specifies the image quality, which ranges from 0 to 1 when the image format is image/jpeg or image/webp . If the value of this parameter exceeds the value range, the default value 0.92 will be used.
-
-
- transferToImageBitmap
-
- None
-
- Creates an ImageBitmap object from the most recent image rendered by Offscreen Canvas .
-
-
-
-
+### getContext
+
+getContext\(type: string, options?: CanvasRenderingContext2DSettings\): OffscreenCanvasRenderingContext2D
+
+Obtains the **OffscreenCanvas** context. This method returns a 2D drawing object.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ contextId
+
+ string
+
+ Yes
+
+ The value can only be "2d" .
+
+
+ options
+
+ CanvasRenderingContext2DSettings
+
+ No
+
+ 2D drawing object, which can be used to draw rectangles , images, and texts, on the OffscreenCanvas .
+
+
+
+
+
+- Return values
+
+
+ Type
+
+ Description
+
+
+
+ OffscreenCanvasRenderingContext2D
+
+ 2D drawing object, which can be used to draw rectangles , images, and texts, on the OffscreenCanvas .
+
+
+
+
+
+
+### toDataURL
+
+toDataURL\(type?: string, quality?:number\):
+
+Generates a URL containing image display information.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ type
+
+ string
+
+ No
+
+ Image format. The default value is image/png .
+
+
+ quality
+
+ number
+
+ No
+
+ Image quality, which ranges from 0 to 1, when the image format is image/jpeg or image/webp . If the set value is beyond the value range, the default value 0.92 is used.
+
+
+
+
+
+- Return values
+
+
+ Type
+
+ Description
+
+
+
+ string
+
+ Image URL.
+
+
+
+
+
+
+### transferToImageBitmap
+
+transferToImageBitmap\(\): ImageBitmap
+
+Creates an **ImageBitmap** object on the most recently rendered image of the **OffscreenCanvas**.
+
+- Return values
+
+
+ Type
+
+ Description
+
+
+
+ ImageBitmap
+
+ Pixel data rendered on the OffscreenCanvas .
+
+
+
+
+
## Example
```
-var canvas = this.$refs.canvasId.getContext('2d');
-var offscreen = new OffscreenCanvas(500,500);
-var offscreenCanvasCtx = offscreen.getContext("2d");
+
+
+
+
+```
+
+```
+//xxx.js
+export default {
+ onShow() {
+ var canvas = this.$refs.canvasId.getContext('2d');
+ var offscreen = new OffscreenCanvas(500,500);
+ var offscreenCanvasCtx = offscreen.getContext("2d");
-// ... some drawing for the canvas using the offscreenCanvasCtx ...
+ // ... some drawing for the canvas using the offscreenCanvasCtx ...
-var dataURL = offscreen.toDataURL();
-console.log(dataURL); //data:image/png;base64,xxxxxx
+ var dataURL = offscreen.toDataURL();
+ console.log(dataURL); //data:image/png;base64,xxxxxx
-var bitmap = offscreen.transferToImageBitmap();
-canvas.transferFromImageBitmap(bitmap);
+ var bitmap = offscreen.transferToImageBitmap();
+ canvas.transferFromImageBitmap(bitmap);
+ }
+}
```
diff --git a/en/application-dev/reference/arkui-js/js-components-canvas-path2d.md b/en/application-dev/reference/arkui-js/js-components-canvas-path2d.md
index bfbaf4f5b612b052ea3b0ab71ff41b2bfcdc7437..fe67c0ed601ba28ea698ed343546002bdbd50827 100644
--- a/en/application-dev/reference/arkui-js/js-components-canvas-path2d.md
+++ b/en/application-dev/reference/arkui-js/js-components-canvas-path2d.md
@@ -1,9 +1,6 @@
# Path2D
-**** allows you to describe a path through an existing path. This path can be drawn through the **stroke** API of **Canvas**.
-
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->This component is supported since API version 6.
+**Path2D** allows you to describe a path through an existing path. This path can be drawn through the **stroke** API of **Canvas**.
## addPath
@@ -14,7 +11,7 @@ Adds a path to this path.
- Parameters
- Parameter
+ Name
Type
@@ -34,27 +31,40 @@ Adds a path to this path.
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path1 = ctx.createPath2D("M250 150 L150 350 L350 350 Z");
- var path2 = ctx.createPath2D();
- path2.addPath(path1);
- ctx.stroke(path2);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path1 = ctx.createPath2D("M250 150 L150 350 L350 350 Z");
+ var path2 = ctx.createPath2D();
+ path2.addPath(path1);
+ ctx.stroke(path2);
+ }
+ }
```
+ ![](figures/en-us_image_0000001173164873.png)
+
## setTransform
setTransform\(scaleX: number, skewX: number, skewY: number, scaleY: number, translateX: number, translateY: number\): void
-Draws an arc based on the radius and points on the arc.
+Sets the path transformation matrix.
- Parameters
- Parameter
+ Name
Type
@@ -109,15 +119,28 @@ Draws an arc based on the radius and points on the arc.
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D("M250 150 L150 350 L350 350 Z");
- path.setTransform(0.8, 0, 0, 0.4, 0, 0);
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path = ctx.createPath2D("M250 150 L150 350 L350 350 Z");
+ path.setTransform(0.8, 0, 0, 0.4, 0, 0);
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001127125208.png)
+
## closePath
@@ -127,18 +150,31 @@ Moves the current point of the path back to the start point of the path, and dra
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D();
- path.moveTo(200, 100);
- path.lineTo(300, 100);
- path.lineTo(200, 200);
- path.closePath();
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path = ctx.createPath2D();
+ path.moveTo(200, 100);
+ path.lineTo(300, 100);
+ path.lineTo(200, 200);
+ path.closePath();
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001127125202.png)
+
## moveTo
@@ -176,18 +212,31 @@ Moves the current coordinate point of the path to the target point, without draw
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D();
- path.moveTo(50, 100);
- path.lineTo(250, 100);
- path.lineTo(150, 200);
- path.closePath();
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path = ctx.createPath2D();
+ path.moveTo(50, 100);
+ path.lineTo(250, 100);
+ path.lineTo(150, 200);
+ path.closePath();
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001173164869.png)
+
## lineTo
@@ -225,19 +274,32 @@ Draws a straight line from the current point to the target point.
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D();
- path.moveTo(100, 100);
- path.lineTo(100, 200);
- path.lineTo(200, 200);
- path.lineTo(200, 100);
- path.closePath();
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path = ctx.createPath2D();
+ path.moveTo(100, 100);
+ path.lineTo(100, 200);
+ path.lineTo(200, 200);
+ path.lineTo(200, 100);
+ path.closePath();
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001127285024.png)
+
## bezierCurveTo
@@ -303,20 +365,33 @@ Draws a cubic bezier curve on the canvas.
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D();
- path.moveTo(10, 10);
- path.bezierCurveTo(20, 100, 200, 100, 200, 20);
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path = ctx.createPath2D();
+ path.moveTo(10, 10);
+ path.bezierCurveTo(20, 100, 200, 100, 200, 20);
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001173324783.png)
+
## quadraticCurveTo
-quadraticCurveTo\(cpx: number, cpy: number, x: number ,y: number\): void
+quadraticCurveTo\(cpx: number, cpy: number, x: number, y: number\): void
Draws a quadratic curve on the canvas.
@@ -364,16 +439,29 @@ Draws a quadratic curve on the canvas.
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D();
- path.moveTo(10, 10);
- path.quadraticCurveTo(100, 100, 200, 20);
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path = ctx.createPath2D();
+ path.moveTo(10, 10);
+ path.quadraticCurveTo(100, 100, 200, 20);
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001173164871.png)
+
## arc
@@ -439,15 +527,28 @@ Draws an arc on the canvas.
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D();
- path.arc(100, 75, 50, 0, 6.28);
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path = ctx.createPath2D();
+ path.arc(100, 75, 50, 0, 6.28);
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001173164867.png)
+
## arcTo
@@ -506,15 +607,28 @@ Draws an arc based on the radius and points on the arc.
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D();
- path.arcTo(150, 20, 150, 70, 50);
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path = ctx.createPath2D();
+ path.arcTo(150, 20, 150, 70, 50);
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001127125204.png)
+
## ellipse
@@ -537,28 +651,28 @@ Draws an ellipse in the specified rectangular region.
number
- X coordinate of the ellipse center
+ X-coordinate of the ellipse center
y
number
- Y coordinate of the ellipse center
+ Y-coordinate of the ellipse center
radiusX
number
- Ellipse radius on the x axis
+ Ellipse radius on the x-axis.
radiusY
number
- Ellipse radius on the y axis
+ Ellipse radius on the y-axis.
rotation
@@ -594,15 +708,28 @@ Draws an ellipse in the specified rectangular region.
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D();
- path.ellipse(200, 200, 50, 100, Math.PI * 0.25, Math.PI * 0.5, Math.PI, 1);
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx =el.getContext('2d');
+ var path = ctx.createPath2D();
+ path.ellipse(200, 200, 50, 100, Math.PI * 0.25, Math.PI * 0.5, Math.PI, 1);
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001173324787.png)
+
## rect
@@ -625,28 +752,28 @@ Creates a rectangle.
number
- X-coordinate of the upper left corner of the rectangle
+ X-coordinate of the upper left corner of the rectangle.
y
number
- Y-coordinate of the upper left corner of the rectangle
+ Y-coordinate of the upper left corner of the rectangle.
width
number
- Width of the rectangle
+ Width of the rectangle.
height
number
- Height of the rectangle
+ Height of the rectangle.
@@ -654,13 +781,25 @@ Creates a rectangle.
- Example
- ![](figures/en-us_image_0000001173164873.png)
+ ```
+
+
+
+
+ ```
```
- const ctx = canvas.getContext('2d');
- var path = ctx.createPath2D();
- path.rect(20, 20, 100, 100);
- ctx.stroke(path);
+ //xxx.js
+ export default {
+ onShow() {
+ const el =this.$refs.canvas;
+ const ctx = el.getContext('2d');
+ var path = ctx.createPath2D();
+ path.rect(20, 20, 100, 100);
+ ctx.stroke(path);
+ }
+ }
```
+ ![](figures/en-us_image_0000001127125212.png)
diff --git a/en/application-dev/reference/arkui-js/js-components-canvas.md b/en/application-dev/reference/arkui-js/js-components-canvas.md
index 1c5e8895af23205c04ade64b3c97d1ae5855747b..ffc337dc7eff4415dc24a5ab9212e19ddc792be8 100644
--- a/en/application-dev/reference/arkui-js/js-components-canvas.md
+++ b/en/application-dev/reference/arkui-js/js-components-canvas.md
@@ -18,4 +18,3 @@
- **[OffscreenCanvasRenderingContext2D](js-offscreencanvasrenderingcontext2d.md)**
-
diff --git a/en/application-dev/reference/arkui-js/js-components-common-animation.md b/en/application-dev/reference/arkui-js/js-components-common-animation.md
index 56c03e6547db8b4484ea2125cb5f766e50cbbace..417c9af4ab1ab4796458a581798352faf31a94b5 100644
--- a/en/application-dev/reference/arkui-js/js-components-common-animation.md
+++ b/en/application-dev/reference/arkui-js/js-components-common-animation.md
@@ -19,7 +19,7 @@ Components support dynamic rotation, translation, and scaling effects. These eff
center center
- Origin position of the transformed element. The unit can be px or a percentage (relative to the animation target component). If only one value is specified, the other value is 50% . The available values for the first string are left , center , and right . The available values for the second string are top , center , and bottom .
+ Origin position of the transformed element. The unit can be px or a percentage (relative to the animation target component). If only one value is specified, the other one is 50% . The available values for the first string are left , center , and right . The available values for the second string are top , center , and bottom .
Example:
transform-origin: 200px 30%
transform-origin: 100px top
@@ -369,7 +369,7 @@ Components support dynamic rotation, translation, and scaling effects. These eff
50% 50%
- Set the background image for a window. The unit can be percentage or px. The first value indicates the horizontal position, and the second value indicates the vertical position. If only one value is specified, the other value is 50% . The available values for the first string are left , center , and right . The available values for the second string are top , center , and bottom .
+ Set the background image for a window. The unit can be percentage or px. The first value indicates the horizontal position, and the second value indicates the vertical position. If only one value is specified, the other one is 50% . The available values for the first string are left , center , and right . The available values for the second string are top , center , and bottom .
Example:
background-position: 200px 30% background-position: 100px top background-position: center center
@@ -464,7 +464,7 @@ export default {
}
```
-![](figures/en-us_image_0000001173324797.gif)
+![](figures/en-us_image_0000001127285034.gif)
```
@@ -522,6 +522,8 @@ export default {
}
```
+![](figures/en-us_image_0000001152833768.gif)
+
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
>The @keyframes rule with **from** and **to** defined cannot be dynamically bound to an element.
>The following figure shows the meanings of end and start in the steps function.
diff --git a/en/application-dev/reference/arkui-js/js-components-common-atomic-layout.md b/en/application-dev/reference/arkui-js/js-components-common-atomic-layout.md
index 3b33bc738a6f1b4fc45a6caa80a21a37f7c36637..0e285159f68c1fe6c1be497f37b9a2f745499655 100644
--- a/en/application-dev/reference/arkui-js/js-components-common-atomic-layout.md
+++ b/en/application-dev/reference/arkui-js/js-components-common-atomic-layout.md
@@ -2,9 +2,6 @@
The atomic layout implements adaptive layout for screens of different sizes and types. Designers can use the atomic layout to define adaptive rules for elements on UIs of different forms. Developers can use the atomic layout to implement the adaptive UI features matching the design effect for a variety of screens.
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The atomic layout is supported since API version 5.
-
## Hiding Components
You can set priority flags for a flex layout that does not support cross-row display to define the display priorities for elements in the horizontal or vertical direction. The elements are hidden based on available space of the container.
@@ -92,4 +89,3 @@ A component with fixed ratio can be scaled up and down while retaining its aspec
-
diff --git a/en/application-dev/reference/arkui-js/js-components-common-attributes.md b/en/application-dev/reference/arkui-js/js-components-common-attributes.md
index ae890a000c7ec4aad8de1c526f66877aef58a40a..7c3db13df60375b2ae5988d747d7c8747da017af 100644
--- a/en/application-dev/reference/arkui-js/js-components-common-attributes.md
+++ b/en/application-dev/reference/arkui-js/js-components-common-attributes.md
@@ -72,18 +72,21 @@ Common attributes are used to set component identities and appearance.
Whether a component is disabled. If it is disabled, it cannot respond to user interaction.
- focusable
+ data
- boolean
+ string
- false
+ -
- No
+ No
- Whether a component can gain focus. When focusable is set to true , the component can respond to focus events and key events. If a key event or click event is set for the component, this attribute is set to true automatically.
+ Attribute set for the component to facilitate data storage and reading. In the JS file:
+Use e.target.attr.data to read data in the event callback, where e is the input parameter. After a DOM element is obtained by using $element or $refs , it can be accessed through attr.data .
+ NOTE: It is recommended that you use data-* since API version 6.
+
- data-* 6+
+ data-* 6+
string
diff --git a/en/application-dev/reference/arkui-js/js-components-common-customizing-font.md b/en/application-dev/reference/arkui-js/js-components-common-customizing-font.md
index d70c0865f4a15e85e06bbd35e43f0268b1f013aa..3f32ff3be75cbdb49ea11a54ec761021e7a00576 100644
--- a/en/application-dev/reference/arkui-js/js-components-common-customizing-font.md
+++ b/en/application-dev/reference/arkui-js/js-components-common-customizing-font.md
@@ -2,10 +2,7 @@
**font-face** is used to define the font style. You can define **font-face** in **style** to specify a font name and resource for your application and then reference this font from **font-family**.
-The custom font can be loaded from the font file in a project.
-
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The font format can be .ttf or .otf.
+The custom font can be loaded from the font file in a project. The font file must be in .ttf or .otf format.
## Defining @font-face
@@ -24,7 +21,7 @@ Customize a font.
Supported sources of customized fonts:
-- Font file in the project: Specify the path of the font file in the project through **url**. \(You can use absolute paths only. For details, see [Resources and File Access Rules](js-framework-file.md#section6620355202117).\)
+- Font file in the project: Specify the path of the font file in the project through **url**. \(You can use absolute paths only. For details, see [Resources and File Access Rules](../../ui/js-framework-file.md#section6620355202117).\)
- You can set only one **src** attribute.
diff --git a/en/application-dev/reference/arkui-js/js-components-common-events.md b/en/application-dev/reference/arkui-js/js-components-common-events.md
index 8424b92f3b3b9735c03d8cc6d7f89f11b5ce64d6..b068eb1672bde489f0cc592fb83eb0df367bb36c 100644
--- a/en/application-dev/reference/arkui-js/js-components-common-events.md
+++ b/en/application-dev/reference/arkui-js/js-components-common-events.md
@@ -165,7 +165,7 @@ Different from private events, universal events can be bound to most components.
DragEvent
- Triggered when dragging is ended.
+ Tiggered when dragging is ended.
No
@@ -174,7 +174,7 @@ Different from private events, universal events can be bound to most components.
DragEvent
- Triggered for entering the component to release.
+ Triggered when the dragged component enters a drop target.
No
@@ -183,7 +183,7 @@ Different from private events, universal events can be bound to most components.
DragEvent
- Triggered for being in the component to release.
+ Triggered when the dragged component is being dragged over a drop target.
No
@@ -192,7 +192,7 @@ Different from private events, universal events can be bound to most components.
DragEvent
- Triggered for exiting the component to release.
+ Triggered when the dragged component leaves a drop target.
No
@@ -201,7 +201,7 @@ Different from private events, universal events can be bound to most components.
DragEvent
- Triggered when the drop operation occurs in the droppable area.
+ Triggered when a component is dropped on a drop target.
No
@@ -210,7 +210,7 @@ Different from private events, universal events can be bound to most components.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- Events not listed in the preceding table are non-bubbling events, such as the [change event](js-components-basic-input.md#section1721512551218). For details, see the specific component.
+>Events not listed in the preceding table are non-bubbling events, such as the [change event](js-components-basic-input.md#section1721512551218). For details, see the specific component.
**Table 1** Attributes of the BaseEvent object
@@ -268,7 +268,7 @@ Different from private events, universal events can be bound to most components.
-**Table 3** Attributes of the TouchEvent object
+**Table 3** TouchInfo
Attribute
@@ -321,16 +321,9 @@ Different from private events, universal events can be bound to most components.
Touch force.
-identifier8+
-
-number
-
-Unique identifier of a touch point on the screen. The value remains unchanged across the events triggered by finger movement on the screen.
-
-
+
-
**Table 4** Attributes of the SwipeEvent object \(inherited from BaseEvent\)
@@ -395,7 +388,7 @@ Different from private events, universal events can be bound to most components.
-**Table 6** Attributes of the KeyEvent object \(inherited from BaseEvent\)7+ \(Rich\)
+**Table 6** Attributes of the DragEvent object \(inherited from BaseEvent\)7+
Attribute
@@ -481,3 +474,4 @@ export default {
}
}
```
+
diff --git a/en/application-dev/reference/arkui-js/js-components-common-gradient.md b/en/application-dev/reference/arkui-js/js-components-common-gradient.md
index f3e2c81c275ea02747579e1f339882c521391a01..e5458a9628650b97d64aac832b8c0a66ba946c74 100644
--- a/en/application-dev/reference/arkui-js/js-components-common-gradient.md
+++ b/en/application-dev/reference/arkui-js/js-components-common-gradient.md
@@ -1,5 +1,6 @@
# Gradient Styles
+
Gradient styles are commonly supported and can be set in the **style** attribute or a **.css** file. Gradients enable smooth transition between two or more specified colors.
This framework supports two gradient styles: linear gradient and repeating linear gradient.
@@ -8,109 +9,113 @@ This framework supports two gradient styles: linear gradient and repeating linea
To use the gradient style, you need to specify the transition direction and transition color.
-1. Transition direction: specified by **direction** or **angle**.
+### Transition Direction
- - **direction**: gradient by direction
- - **angle**: gradient by angle
+The available values are as follows:
- ```
- background: linear-gradient(direction/angle, color, color, ...);
- background: repeating-linear-gradient(direction/angle, color, color, ...);
- ```
+- **direction**: gradient by direction
+- **angle**: gradient by angle
-2. Transition color: \#ff0000, \#ffff0000, rgb \(255, 0, 0\), and rgba \(255, 0, 0, 1\). At least two colors must be specified.
+```
+background: linear-gradient(direction/angle, color, color, ...);
+background: repeating-linear-gradient(direction/angle, color, color, ...);
+```
-- Parameter
+### Transition Color
-
- Name
+The following four colors are supported: \#ff0000, \#ffff0000, rgb \(255, 0, 0\) and rgba \(255, 0, 0, 1\). At least two colors must be specified.
+
+- Name
+
+
+ Name
- Type
+ Type
- Default Value
+ Default Value
- Mandatory
+ Mandatory
- Description
+ Description
- direction
+ direction
- to <side-or-corner> <side-or-corner> = [left | right] || [top | bottom]
+ to <side-or-corner> <side-or-corner> = [left | right] || [top | bottom]
- to bottom (gradient from top to bottom)
+ to bottom (gradient from top to bottom)
- No
+ No
- Transition direction. For example, to right (gradient from left to right) or
- to bottom right (from the top left to the bottom right).
+ Transition direction. For example, to right (gradient from left to right) or
+ to bottom right (from the top left to the bottom right).
- angle
+ angle
- <deg>
+ <deg>
- 180deg
+ 180deg
- No
+ No
- Transition direction. Angle between the gradient line and the y-axis (in the clockwise direction), with the geometric center of the element being the origin of coordinates and the horizontal axis being the x-axis.
+ Transition direction. Angle between the gradient line and the y-axis (in the clockwise direction), with the geometric center of the element being the origin of coordinates and the horizontal axis being the x-axis.
- color
+ color
- <color> [<length>|<percentage>]
+ <color> [<length>|<percentage>]
- -
+ -
- Yes
+ Yes
- Colors among which smooth transitions are rendered.
+ Colors among which smooth transitions are rendered.
-- Example:
+- Example
+
+ 1. Gradient from top to bottom \(default\)
```
#gradient {
height: 300px;
width: 600px;
+ /* Gradient starts from red at the top to green at the bottom. */
+ background: linear-gradient(red, #00ff00);
}
```
- **Figure 1** Gradient from top to bottom \(default\)
- ![](figures/gradient-from-top-to-bottom-(default).png "gradient-from-top-to-bottom-(default)")
+ ![](figures/111.png)
- ```
- /* Gradient starts from red at the top to green at the bottom. */
- background: linear-gradient(red, #00ff00);
- ```
-
- **Figure 2** Gradient at an angle of 45°
- ![](figures/gradient-at-an-angle-of-45.png "gradient-at-an-angle-of-45")
+ 2. Gradient at an angle of 45°
```
/* Gradient at an angle of 45°, changing from red to green */
- background: linear-gradient(45deg, rgb(255,0,0),rgb(0, 255, 0));
+ background: linear-gradient(45deg, rgb(255,0,0),rgb(0, 255, 0));
```
- **Figure 3** Gradient from left to right
- ![](figures/gradient-from-left-to-right.png "gradient-from-left-to-right")
+ ![](figures/222.png)
+
+ 3. Gradient from left to right
```
/* Gradient from left to right, which is available in the 270 px width between the left 90 px and the left 360 px (600*0.6) */
background: linear-gradient(to right, rgb(255,0,0) 90px, rgb(0, 255, 0) 60%);
```
- **Figure 4** Repeating gradient from left to right
- ![](figures/repeating-gradient-from-left-to-right.png "repeating-gradient-from-left-to-right")
+ ![](figures/333.png)
+
+ 4. Repeating gradient
```
- /* Repeating gradient from left to right, the area of which is 30 px (60-30) and the transparency is 0.5 */
+ /* Repeating gradient from left to right, the area of which is 30 px (60-30) and the opacity is 0.5 */
background: repeating-linear-gradient(to right, rgba(255, 255, 0, 1) 30px,rgba(0, 0, 255, .5) 60px);
```
+ ![](figures/444.png)
diff --git a/en/application-dev/reference/arkui-js/js-components-common-mediaquery.md b/en/application-dev/reference/arkui-js/js-components-common-mediaquery.md
index 8acaf040924fd9256a1d0458bf1dabdb02641e8a..fd0654a19f27593c4e7a8390c230cdf5eb5e2ec6 100644
--- a/en/application-dev/reference/arkui-js/js-components-common-mediaquery.md
+++ b/en/application-dev/reference/arkui-js/js-components-common-mediaquery.md
@@ -1,13 +1,13 @@
# Media Query
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>- The **media** attribute uses the actual size, physical pixel, and screen resolution of the device by default. Do not confuse them with the configuration based on basic screen width 720 px.
+
Media query is widely used on mobile devices. You may need to frequently modify the application style based on the device type or specific features and device parameters \(such as the screen resolution\). To keep up with your requirements, the media query component provides the following features:
1. Allows you to design different layouts matching the device and application attributes.
2. Synchronously updates the application page layouts when your screen changes dynamically \(for example, in the event of screen splitting or landscape/portrait orientation switching\).
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The **media** attribute uses the actual size, physical pixel, and screen resolution of the device by default. Do not confuse them with the configuration based on basic screen width 720 px.
-
## CSS Syntax Rules
Use @media to import query statements. The rules are as follows:
@@ -123,22 +123,22 @@ At MediaQuery Level 4, range query is imported so that you can use the operators
<=
- Less than or equal to, for example, screen and (50 <= height) .
+ Less than or equal to, for example, screen and (50 <= height).
>=
- Greater than or equal to, for example, screen and (600 >= height) .
+ Greater than or equal to, for example, screen and (600 >= height).
<
- Less than, for example, screen and (50 < height) .
+ Less than, for example, screen and (50 < height).
>
- Greater than, for example, screen and (600 > height) .
+ Greater than, for example, screen and (600 > height).
diff --git a/en/application-dev/reference/arkui-js/js-components-common-methods.md b/en/application-dev/reference/arkui-js/js-components-common-methods.md
index 2a60d488203a815fd2f37f22380620946f1b6aa5..221a5a9de52b56488cf80ad1de5e4dcbc8961db4 100644
--- a/en/application-dev/reference/arkui-js/js-components-common-methods.md
+++ b/en/application-dev/reference/arkui-js/js-components-common-methods.md
@@ -2,537 +2,431 @@
After a component is assigned the **id** attribute, you can use the ID to obtain the component objects and call functions.
-
- Name
-
- Parameter
-
- Mandatory
-
- Return Value
-
- Description
-
-
-
- animate
-
-
- keyframes: Keyframes , options: Options
-
- Yes
-
- -
-
- Creates and runs an animation shortcut on the component. Specify the keyframes and options required for the animation. This method returns the animation object.
-
-
- getBoundingClientRect 6+
-
- -
-
- -
-
-Rect
-
- Obtains the size of the element and its position relative to the window.
-
-
- createIntersectionObserver 6+
-
-ObserverParam
-
-
-Observer
-
- Adds an Observer , which will be notified of the changes of a component on the current page.
-
-
-
-
-
-**Table 1** Rect object description 6+
-
-
- Attribute
-
- Type
-
- Description
-
-
-
- width
-
- number
-
- Width of an element.
-
-
- height
-
- number
-
- Height of an element.
-
-
- left
-
- number
-
- Offset between the left boundary of the element and the window.
-
-
- top
-
- number
-
- Offset between the upper boundary of the element and the window.
-
-
-
-
-
-**Table 2** ObserverParam attributes6+
-
-
- Attribute
-
- Type
-
- Description
-
-
-
- ratios
-
- Array<number>
-
- When the component is out of the range or is less than the range, the observer callback is triggered.
-
-
-
-
-
-**Table 3** Methods supported by the Observer object6+
-
-
- Name
-
- Parameter
-
- Description
-
-
-
- observe
-
- callback: function
-
- Subscribes to events of the observed object. The callback method is called when the value is greater than or less than the threshold.
-
-
- unobserve
-
-
- Unsubscribes from events of the observed object.
-
-
-
-
-
-## this.$element\('_id_'\).animate\(Object, Object\)
-
-You can use the **animate\(keyframes: Keyframes, options: Options\)** method to obtain an animation object. This object supports properties, methods, and events of the animation component. If **animate** is called for multiple times and the replace policy is used, parameters passed to the last call will take effect.
-
-**Table 4** Keyframes
-
-
- Parameter
-
- Type
-
- Description
-
-
-
- frames
-
- Array<Style>
-
- Array of objects used to set animation style attributes. For details about style attributes, see Style attributes .
-
-
-
-
-
-**Table 5** Style attributes
-
-
- Parameter
-
- Type
-
- Default Value
-
- Description
-
-
-
- width
-
- number
-
- -
-
- Width set for the component during playback of the animation.
-
-
- height
-
- number
-
- -
-
- Height set for the component during playback of the animation.
-
-
- backgroundColor
-
- <color>
-
- none
-
- Background color set for the component during playback of the animation.
-
-
- opacity
-
- number
-
- 1
-
- Opacity set for the component. The value ranges from 0 to 1 .
-
-
- backgroundPosition
-
- string
-
- -
-
- The value format is x y , in percentage or pixels.
- The first value indicates the horizontal position, and the second value indicates the vertical position.
- If only one value is specified, the other value is 50% by default.
-
-
- transformOrigin
-
- string
-
- 'center center'
-
- Origin position of the transformed element.
- The first value indicates the x-axis position. The value can be left , center , right , a length, or a percentage.
- The second value indicates the y-axis position. The value can be top , center , bottom , a length, or a percentage.
-
-
- transform
-
-Transform
-
- -
-
- Transformation type set for a transformed element.
-
-
- offset
-
- number
-
- -
-
-The value of offset must be within (0.0,1.0] and sorted in ascending order if it is provided. If there are only two frames, offset can be left empty. If there are more than two frames, offset is mandatory.
-
-
-
-
-
-**Table 6** Options
-
-
- Parameter
-
- Type
-
- Default Value
-
- Description
-
-
-
- duration
-
- number
-
- 0
-
- Duration for playing the animation, in milliseconds.
-
-
- easing
-
- string
-
- linear
-
- Time curve of the animation. For details about the supported types, see Available values of the easing attribute .
-
-
- delay
-
- number
-
- 0
-
- Delay for the animation start. The default value indicates no delay.
-
-
- iterations
-
- number | string
-
- 1
-
- Number of times the animation will be played. number indicates a fixed number of playback operations, and Infinity indicates an unlimited number of playback operations.
-
-
- direction 6+
-
- string
-
- normal
-
- Mode of playing the animation.
- normal : Plays the animation in forward loop mode.
- reverse : Plays the animation in reverse loop mode.
- alternate : Plays the animation in alternating loop mode. When the animation is played for an odd number of times, the playback is in forward direction. When the animation is played for an even number of times, the playback is in backward direction.
- alternate-reverse : Plays the animation in reverse-alternating loop mode. When the animation is played for an odd number of times, the playback is in backward direction. When the animation is played for an even number of times, the playback is in forward direction.
-
-
- fill
-
- string
-
- none
-
- Start and end styles of the animation.
- none : No style is applied to the target before or after the animation is executed.
- forwards : The target keeps the state at the end of the animation (defined in the last key frame) after the animation is executed.
- backwards 6+ : The animation uses the value defined in the first key frame during the animation-delay . When animation-direction is set to normal or alternate , the value in the from key frame is used. When animation-direction is set to reverse or alternate-reverse , the value in the to key frame is used..
- both 6+ : The animation follows the forwards and backwards rules.
-
-
-
-
-
-**Table 7** Available values of the easing attribute
-
-
- Type
-
- Description
-
-
-
- linear
-
- The animation speed keeps unchanged.
-
-
- ease-in
-
- The animation starts at a low speed. cubic-bezier(0.42, 0.0, 1.0, 1.0) .
-
-
- ease-out
-
- The animation ends at a low speed. cubic-bezier(0.0, 0.0, 0.58, 1.0) .
-
-
- ease-in-out
-
- The animation starts and ends at a low speed. cubic-bezier(0.42, 0.0, 0.58, 1.0) .
-
-
- friction
-
- Damping curve, cubic-bezier(0.2, 0.0, 0.2, 1.0) .
-
-
- extreme-deceleration
-
- Extreme deceleration curve, cubic-bezier(0.0, 0.0, 0.0, 1.0) .
-
-
- sharp
-
- Sharp curve, cubic-bezier(0.33, 0.0, 0.67, 1.0) .
-
-
- rhythm
-
- Rhythm curve, cubic-bezier(0.7, 0.0, 0.2, 1.0) .
-
-
- smooth
-
- Smooth curve, cubic-bezier(0.4, 0.0, 0.4, 1.0) .
-
-
- cubic-bezier(x1, y1, x2, y2)
-
- You can customize an animation speed curve in the cubic-bezier() function. The x and y values of each input parameter must be between 0 and 1.
-
-
- steps(number, step-position) 6+
-
- Step curve.
- The number must be set and only an integer is supported.
- step-position is optional. It can be set to start or end . The default value is end .
-
-
-
-
+## animate
-- Return values
+animate\( keyframes: Keyframes, options: Options\): void
- Attributes supported by the animation object
+- Name
-
- Attribute
+
+ Name
+
+ Type
- Type
+ Mandatory
- Description
+ Description
- finished
+ keyframes
- boolean
+ keyframes
- Read-only attribute, which indicates whether the animation playback is complete.
+ Yes
+
+ Sets the animation style.
- pending
+ options
+
+ Options
- boolean
+ Yes
- Read-only attribute, which indicates whether the animation is waiting for the completion of other asynchronous operations (for example, start an animation with a delay).
+ Array of objects used to set animation attributes. For details, see Options .
- playState
+
+
+
+ **Table 1** keyframes
+
+
+ Attribute
+
+ Type
+
+ Description
+
+
+
+ frames
- string
+ Array<Style>
- Read-write attribute, which indicates the playback status of the animation:
- idle : The animation is not running (playback ended or not started). running : The animation is running. paused : The animation is paused. finished : Animation playback ends.
+ Array of objects used to set animation attributes. For details about style attributes, see Style attributes .
- startTime
+
+
+
+ **Table 2** Style attributes
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+ width
+
+ number
- number
+ -
- Read-write attribute, which indicates the animation start time. This attribute is similar to delay in the options attribute.
+ Width set for the component during playback of the animation.
+
+
+ height
+
+ number
+
+ -
+
+ Height set for the component during playback of the animation.
+
+
+ backgroundColor
+
+ <color>
+
+ none
+
+ Background color set for the component during playback of the animation.
+
+
+ opacity
+
+ number
+
+ 1
+
+ Opacity set for the component. The value ranges from 0 to 1 .
+
+
+ backgroundPosition
+
+ string
+
+ -
+
+ The value format is x y , in percentage or pixels.
+ The first value indicates the horizontal position, and the second value indicates the vertical position.
+ If only one value is specified, the other value is 50% by default.
+
+
+ transformOrigin
+
+ string
+
+ 'center center'
+
+ Origin position of the transformed element.
+ The first value indicates the x-axis position. The value can be left , center , right , a length, or a percentage.
+ The second value indicates the y-axis position. The value can be top , center , bottom , a length, or a percentage.
+
+
+ transform
+
+ Transform
+
+ -
+
+ Transformation type set for a transformed element.
+
+
+ offset
+
+ number
+
+ -
+
+ The value of offset must be within (0.0,1.0] and sorted in ascending order if it is provided. If there are only two frames, offset can be left empty. If there are more than two frames, offset is mandatory.
- Methods supported by the animation object
+ **Table 3** Options description
-
- Method
+
+ Name
+
+ Type
+
+ Default Value
- Parameter
+ Description
- Description
+
+
+ duration
+
+ number
+
+ 0
+
+ Duration for playing the animation, in milliseconds.
+
+
+ easing
+
+ string
+
+ linear
+
+ Time curve of the animation. For details about the supported types, see Available values of the easing attribute .
+
+
+ delay
+
+ number
+
+ 0
+
+ Delay for the animation start. The default value indicates no delay.
+
+
+ iterations
+
+ number | string
+
+ 1
+
+ Number of times the animation will be played. number indicates a fixed number of playback operations, and Infinity indicates an unlimited number of playback operations.
+
+
+ direction 6+
+
+ string
+
+ normal
+
+ Mode of playing the animation.
+ normal : Plays the animation in forward loop mode.
+ reverse : Plays the animation in reverse loop mode.
+ alternate : Plays the animation in alternating loop mode. When the animation is played for an odd number of times, the playback is in forward direction. When the animation is played for an even number of times, the playback is in backward direction.
+ alternate-reverse : Plays the animation in reverse-alternating loop mode. When the animation is played for an odd number of times, the playback is in backward direction. When the animation is played for an even number of times, the playback is in forward direction.
+
+
+ fill
+
+ string
+
+ none
+
+ Start and end styles of the animation.
+ none : No style is applied to the target before or after the animation is executed.
+ forwards : The target keeps the state at the end of the animation (defined in the last key frame) after the animation is executed.
+ backwards 6+ : The animation uses the value defined in the first key frame during the animation-delay . When animation-direction is set to normal or alternate , the value in the from key frame is used. When animation-direction is set to reverse or alternate-reverse , the value in the to key frame is used.
+ both 6+ : The animation follows the forwards and backwards rules.
+
+
+
+
+
+ **Table 4** Available values of the easing attribute
+
+
+ Type
+
+ Description
- play
+ linear
+
+ The animation speed keeps unchanged.
+
+
+ ease-in
+
+ The animation starts at a low speed. cubic-bezier(0.42, 0.0, 1.0, 1.0) .
+
+
+ ease-out
+
+ The animation ends at a low speed. cubic-bezier(0.0, 0.0, 0.58, 1.0) .
+
+
+ ease-in-out
+
+ The animation starts and ends at a low speed. cubic-bezier(0.42, 0.0, 0.58, 1.0) .
+
+
+ friction
+
+ Damping curve, cubic-bezier(0.2, 0.0, 0.2, 1.0) .
+
+
+ extreme-deceleration
+
+ Extreme deceleration curve, cubic-bezier(0.0, 0.0, 0.0, 1.0) .
+
+
+ sharp
+
+ Sharp curve, cubic-bezier(0.33, 0.0, 0.67, 1.0) .
+
+
+ rhythm
+
+ Rhythm curve, cubic-bezier(0.7, 0.0, 0.2, 1.0) .
+
+
+ smooth
- -
+ Smooth curve, cubic-bezier(0.4, 0.0, 0.4, 1.0) .
- Plays the animation.
+
+ cubic-bezier(x1, y1, x2, y2)
+
+ You can customize an animation speed curve in the cubic-bezier() function. The x and y values of each input parameter must be between 0 and 1.
+
+
+ steps(number, step-position) 6+
+ Step curve.
+ The number must be set and only an integer is supported.
+ step-position is optional. It can be set to start or end . The default value is end .
+
+
+
+
+
+- Return values
+
+ The **animation** attributes are as follows.
+
+
+ Attribute
+
+ Type
+
+ Description
+
- finish
+
+ finished
- -
+ boolean
- Ends the animation.
+ Read-only attribute, which indicates whether the animation playback is complete.
- pause
+ pending
- -
+ boolean
- Pauses the animation.
+ Read-only attribute, which indicates whether the animation is waiting for the completion of other asynchronous operations (for example, start an animation with a delay).
- cancel
+ playState
- -
+ string
- Cancels the animation.
+ Read-write attribute, which indicates the playback status of the animation:
+ idle : The animation is not running (playback ended or not started). running : The animation is running. paused : The animation is paused. finished : Animation playback ends.
- reverse
+ startTime
- -
+ number
- Plays the animation in reverse direction.
+ Read-write attribute, which indicates the animation start time. This attribute is similar to delay in the options attribute.
- Events supported by the animation object
+ Methods for animation
-
- Event
+
+ Method
- Description
+ Parameter
+
+ Description
- start 6+
+ play
+
+ -
- The animation starts.
+ Plays the animation.
- cancel
+ finish
- The animation is forcibly canceled.
+ -
+
+ Ends the animation.
- finish
+ pause
+
+ -
- The animation playback is complete.
+ Pauses the animation.
- repeat
+ cancel
- The animation repeats.
+ -
+
+ Cancels the animation.
+
+
+ reverse
+
+ -
+
+ Plays the animation in reverse.
+ Events for animation
-- Example code:
+
+ Event
+
+ Description
+
+
+
+ start 6+
+
+ The animation starts.
+
+
+ cancel
+
+ The animation is forcibly canceled.
+
+
+ finish
+
+ The animation playback is complete.
+
+
+ repeat
+
+ The animation repeats.
+
+
+
+
+
+- Example
```
@@ -628,13 +522,59 @@ You can use the **animate\(keyframes: Keyframes, options: Options\)** method t
}
```
- ![](figures/en-us_image_0000001173324753.gif)
+ ![](figures/animationapi-4.gif)
+
+## getBoundingClientRect
-## this.$element\('_id_'\).getBoundingClientRect\(\)6+
+getBoundingClientRect\(\): [ ](#table1650917111414)
Obtains the size of the element and its position relative to the window.
+- Return values
+
+ **Table 5** Rect attributes6+
+
+
+ Attribute
+
+ Type
+
+ Description
+
+
+
+ width
+
+ number
+
+ Width of an element.
+
+
+ height
+
+ number
+
+ Height of an element.
+
+
+ left
+
+ number
+
+ Offset between the left boundary of the element and the window.
+
+
+ top
+
+ number
+
+ Offset between the upper boundary of the element and the window.
+
+
+
+
+
- Example
```
@@ -644,10 +584,88 @@ Obtains the size of the element and its position relative to the window.
```
-## this.$element\('_id_'\).createIntersectionObserver\(\)6+
+## createIntersectionObserver
+
+createIntersectionObserver\(param?: [ObserverParam](#table143341035121917)\):[Observer](#table4506633141711)
Gets notified of the visibility of an element on the current page.
+- Name
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ param
+
+ ObserverParam
+
+ -
+
+ Obtains the observer callback.
+
+
+
+
+
+ **Table 6** ObserverParam attributes6+
+
+
+ Attribute
+
+ Type
+
+ Description
+
+
+
+ ratios
+
+ Array<number>
+
+ When the component is out of the range or is less than the range, the observer callback is triggered.
+
+
+
+
+
+- Return values
+
+ **Table 7** Methods supported by the Observer object6+
+
+
+ Name
+
+ Parameter
+
+ Description
+
+
+
+ observe
+
+ callback: function
+
+ Subscribes to events of the observed object. The callback method is called when the value is greater than or less than the threshold.
+
+
+ unobserve
+
+ -
+
+ Unsubscribes from events of the observed object.
+
+
+
+
+
- Example
```
@@ -663,4 +681,3 @@ Gets notified of the visibility of an element on the current page.
observer.unobserve()
```
-
diff --git a/en/application-dev/reference/arkui-js/js-components-common-styles.md b/en/application-dev/reference/arkui-js/js-components-common-styles.md
index 3d8101ef286e7a4dc9d0ad607da1a3e4b5ce2a61..efa11d67495646d34ef6250230ca4fcdb6497f55 100644
--- a/en/application-dev/reference/arkui-js/js-components-common-styles.md
+++ b/en/application-dev/reference/arkui-js/js-components-common-styles.md
@@ -150,8 +150,8 @@ You can set component appearance in the **style** attribute or **.css** file
solid
Shorthand attribute to set the style for all borders. Available values are as follows:
- dotted : Dotted border. The radius of a dot is half of border-width. dashed : Dashed border
-
+ dotted : dotted border. The radius of a dot is half of border-width. dashed : dashed border.
+
border-[left|top|right|bottom]-style
@@ -215,6 +215,8 @@ You can set component appearance in the **style** attribute or **.css** file
-
Attribute to set the radius of round borders of an element. This attribute cannot be used to set the width, color, or style of a specific border. To set the width or color, you need to set border-width , border-color , or border-style for all the borders at the same time.
+ NOTE: In the four-value syntax, the values apply to lower-left corner, lower-right corner, upper-left corner, and upper-right corner, respectively.
+
border-[top|bottom]-[left|right]-radius
@@ -223,7 +225,7 @@ You can set component appearance in the **style** attribute or **.css** file
-
- Attribute to receptively set the radii of upper-left, upper-right, lower-right, and lower-left rounded corners
+ Attribute to respectively set the radii of upper-left, upper-right, lower-right, and lower-left rounded corners
background
@@ -250,9 +252,11 @@ You can set component appearance in the **style** attribute or **.css** file
-
- Background image. Currently, this attribute is not compatible with background-color or background . Local and online image resources are supported.
- Example:
- background-image: url("/common/background.png")
+ Background image. Currently, this attribute is not compatible with background-color or background . Local image resources are supported.
+ Example:
+background-image: url("/common/background.png") NOTE: The SVG format is not supported.
+
+
background-size
@@ -264,7 +268,7 @@ You can set component appearance in the **style** attribute or **.css** file
Background image size.
The string values are as follows: contain : Expands the image to the maximum size so that the height and width of the image are applicable to the content area. cover : Extends the background image to a large enough size so that the background image completely covers the background area. Some parts of the image may not be displayed in the background area. auto : The original image width-height ratio is retained.
The two <length> values are as follows: Width and height of the background image. The first value indicates the width, and the second value indicates the height. If you only set one value, the other value is set to auto by default.
- The two <percentage> values are as follows: Width and height of the background image in percentage of the parent element. The first value indicates the width, and the second value indicates the height. If you only set one value, the other value is set to auto by default.
+ The two <percentage> values are as follows: Width and height of the background image in percentage of the parent element. The first value indicates the width, and the second value indicates the height. If you only set one value, the other value is set to auto by default.
@@ -325,29 +329,13 @@ You can set component appearance in the **style** attribute or **.css** file
backdrop-filter: blur(10px)
- window-filter 5+
-
- string
-
- -
-
- Blur degree and style for windows within the component layout. If this style is not set, the default value 0% (no blur) is used.
- Different blur degrees and styles for multiple blur areas are not supported.
- Available blur styles are as follows: small_light (default value), medium_light , large_light , xlarge_light , small_dark , medium_dark , large_dark , and xlarge_dark .
- Syn tax: window-filter: blur(percent, style 5+ )
- Example:
-window-filter: blur(50%) window-filter: blur(10%), large_light
- NOTE: This style is only supported on phones and tablets.
-
-
-
opacity
number
1
- Transparency of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent.
+ Opacity of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent.
display
@@ -380,7 +368,7 @@ You can set component appearance in the **style** attribute or **.css** file
-
- How to divide available space of the parent component for a child component.
+ How to divide available space of the parent component for each child component.
You can set one, two 5+ , or three 5+ values for this style.
Set one value in either of the following ways:
A unitless number to set flex-grow . A valid width value 5+ to set flex-basis .
@@ -524,10 +512,10 @@ You can set component appearance in the **style** attribute or **.css** file
auto
Display size of the mask image. The setting is valid only when mask-image is set to an image source.
- The string values are as follows:
- contain : Expands the image to the maximum size so that the height and width of the image are applicable to the content area. cover : Extends the image to a large enough size so that it completely covers the background area. Some parts of the image may not be displayed in the background area. auto : The original image width-height ratio is retained.
- length indicates the width and height of the image. The first value indicates the width, and the second value indicates the height. If you only set one value, the other value is set to auto by default.
- When you set the width and height with percentage values, the image size is set in relative to the original size. The first value indicates the width, and the second value indicates the height. If you only set one value, the other value is set to auto by default.
+ The string values are as follows:
+ contain : Expands the image to the maximum size so that the height and width of the image are applicable to the content area. cover : Extends the image to a large enough size so that it completely covers the background area. Some parts of the image may not be displayed in the background area. auto : The original image width-height ratio is retained.
+ length indicates the width and height of the image. The first value indicates the width, and the second value indicates the height. If you only set one value, the other value is set to auto by default.
+ When you set the width and height with percentage values, the image size is set in relative to the original size. The first value indicates the width, and the second value indicates the height. If you only set one value, the other value is set to auto by default.
mask-position 6+
@@ -537,11 +525,11 @@ You can set component appearance in the **style** attribute or **.css** file
0px 0px
Display position of the mask image. The setting is valid only when mask-image is set to an image source. Using keywords: If only one keyword is specified, the other value is center by default. The two values define the horizontal position and vertical position, respectively.
- The string values are as follows:
- left : leftmost in the horizontal direction right : rightmost in the horizontal direction top : top in the vertical direction bottom : bottom in the vertical direction center : center position
- Using <length> : The first value indicates the horizontal position, and the second value indicates the vertical position. 0 0 indicates the upper left corner. The unit is pixel. If only one value is specified, the other one is 50% .
- Using <percentage> : The first value indicates the horizontal position, and the second value indicates the vertical position. 0% 0% indicates the upper left corner. 100% 100% indicates the lower right corner. If only one value is specified, the other one is 50% .
- Using both <percentage> and <length> .
+ The string values are as follows:
+ left : leftmost in the horizontal direction right : rightmost in the horizontal direction top : top in the vertical direction bottom : bottom in the vertical direction center : center position
+ Using <length> : The first value indicates the horizontal position, and the second value indicates the vertical position. 0 0 indicates the upper left corner. The unit is pixel. If only one value is specified, the other one is 50% .
+ Using <percentage> : The first value indicates the horizontal position, and the second value indicates the vertical position. 0% 0% indicates the upper left corner. 100% 100% indicates the lower right corner. If only one value is specified, the other one is 50% .
+ Using both <percentage> and <length> .
border-image-source 7+
@@ -575,7 +563,7 @@ You can set component appearance in the **style** attribute or **.css** file
0
- Width of the image boundary.
+ Width of the border image.
If you set only one value, it specifies the width for four sides.
If you set two values, the first value specifies the top and bottom width, and the second value specifies the left and right width.
If you set three values, the first value specifies the top width, the second value specifies the left and right width, and the third value specifies the bottom width.
@@ -588,7 +576,7 @@ You can set component appearance in the **style** attribute or **.css** file
0
- Size of the border image that can exceed the border.
+ How far the border image can extend beyond the border box.
If you set only one value, it specifies the distance of the boarder image beyond the border on four sides.
If you set two values, the first value specifies the distance of the boarder image's top and bottom sides beyond the boarder, and the second value specifies the distance of the boarder image's left and right sides beyond the boarder.
If you set three values, the first value specifies the distance of the boarder image's top side beyond the boarder, the second value specifies the distance of the boarder image's left and right sides beyond the boarder, and the third value specifies the distance of the boarder image's bottom side beyond the boarder.
@@ -601,10 +589,10 @@ You can set component appearance in the **style** attribute or **.css** file
stretch
- How the image fills the border.
- stretch : stretches the image to fill the border.
- repeat : tiles the image to fill the border.
- round : tiles the image. When the image cannot be tiled for an integer number of times, it can be scaled based on the site requirements.
+ How the border image fills the border box.
+ stretch : stretches the image to fill the border box.
+ repeat : tiles the image to fill the border box.
+ round : tiles the image to fill the border box. When the image cannot be tiled for an integer number of times, it can be scaled based on the site requirements.
border-image 7+
@@ -614,7 +602,7 @@ You can set component appearance in the **style** attribute or **.css** file
-
Shorthand attribute. The options are as follows:
-
-## Example Code
+## Example
1. Flex style
@@ -466,7 +466,7 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
}
```
- ![](figures/22-25.png)
+ ![](figures/22.png)
3. Grid style
@@ -532,7 +532,7 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
}
```
- ![](figures/11-26.png)
+ ![](figures/11.png)
4. Dragging7+
@@ -570,8 +570,8 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
})
},
drag(e){
- this.left = e.dragevent.globalX;
- this.top = e.dragevent.globalY;
+ this.left = e.globalX;
+ this.top = e.globalY;
},
dragend(e){
prompt.showToast({
@@ -581,7 +581,7 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
}
```
- ![](figures/9-27.gif)
+ ![](figures/9.gif)
```
@@ -618,8 +618,8 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
top:0,
},
drag(e){
- this.left = e.dragevent.globalX;
- this.top = e.dragevent.globalY;
+ this.left = e.globalX;
+ this.top = e.globalY;
},
dragenter(e){
prompt.showToast({
@@ -644,7 +644,7 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
}
```
- ![](figures/6-28.gif)
+ ![](figures/6.gif)
5. Pinching7+
@@ -700,6 +700,5 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
}
```
- ![](figures/5-29.gif)
-
+ ![](figures/5.gif)
diff --git a/en/application-dev/reference/arkui-js/js-components-container-form.md b/en/application-dev/reference/arkui-js/js-components-container-form.md
index 7508a85a1ab09f220c05fedda318ae24e444d09d..23d52f34982ef8067457fac1bb81a02b85c471e8 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-form.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-form.md
@@ -2,9 +2,6 @@
The **
-## Method
+## Methods
Methods in [Universal Methods](js-components-common-methods.md) are supported.
-## Example:
+## Example
```
```
@@ -105,3 +106,5 @@ export default{
}
```
+![](figures/001.gif)
+
diff --git a/en/application-dev/reference/arkui-js/js-components-container-list-item-group.md b/en/application-dev/reference/arkui-js/js-components-container-list-item-group.md
index 89abe5230ab735f8bf86951bc391d0bf85a130a1..94c1d783105f88d9b17b78737f92d91615633b49 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-list-item-group.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-list-item-group.md
@@ -2,19 +2,18 @@
**** is a child component of **<[list](js-components-container-list.md)\>** and is used to group items in a list. By default, the width of **** is equal to that of ****.
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- To use this component, you must set the **columns** attribute of the parent component **** to **1**. Otherwise, **** is not displayed.
->- You can customize the width of each ****. However, if you retain the default value **stretch** of **align-items** for the parent component ****, the width of **** is equal to that of ****. You can set **align-items** to other values rather than **stretch** to make the customized **** width take effect.
+- To use this component, you must set the **columns** attribute of the parent component **** to **1**. Otherwise, **** is not displayed.
+- You can customize the width of each ****. However, if you retain the default value **stretch** of **align-items** for the parent component ****, the width of **** is equal to that of ****. You can set **align-items** to other values rather than **stretch** to make the customized **** width take effect.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
Only **<[list-item](js-components-container-list-item.md)\>** are supported.
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -48,7 +47,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
>- **id** in the common attributes is used to identify a group. The input parameters of related functions and event information in the list also use **id** to uniquely identify a group.
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -92,7 +91,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
-## Event
+## Events
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
@@ -134,11 +133,11 @@ In addition to the events in [Universal Events](js-components-common-events.md)
-## Method
+## Methods
Methods in [Universal Methods](js-components-common-methods.md) are supported.
-## Example Code
+## Example
```
diff --git a/en/application-dev/reference/arkui-js/js-components-container-list-item.md b/en/application-dev/reference/arkui-js/js-components-container-list-item.md
index af8fdffb9e58970b39b71ca345571e36e4bd8db9..1a3f12dfcce31fe4780ff17bed4de809d50915f7 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-list-item.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-list-item.md
@@ -1,19 +1,16 @@
# list-item
-**** is a child component of the **<[list](js-components-container-list.md)\>** component and is used to display items in a list.
+**** is a child component of the **<[list](js-components-container-list.md)\>** component and is used to display items in a list. You can customize the width of each ****. However, if you retain the default value **stretch** of **align-items** for the parent component ****, the width of **** is equal to that of ****. You can set **align-items** to other values rather than **stretch** to make the customized **** width take effect.
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->You can customize the width of each ****. However, if you retain the default value **stretch** of **align-items** for the parent component ****, the width of **** is equal to that of ****. You can set **align-items** to other values rather than **stretch** to make the customized **** width take effect.
-
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
-Supported
+This component supports only one child component.
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -38,7 +35,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
No
- Type of the list-item. A list can contain multiple list-item types. The same type of list items should have the same view layout after being rendered. If the type is fixed, replace the if attribute with the show attribute to ensure that the view layout remains unchanged.
+ Type of the list-item. A list can contain multiple list-item types. The same type of list items should have the same view layout after being rendered. When the type is fixed, replace the if attribute with the show attribute to ensure that the view layout remains unchanged.
primary
@@ -75,17 +72,6 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
none : The current item does not stick at the top. normal : The current item sticks at the top and disappears with a sliding effect. opacity : The current item sticks at the top and disappears gradually. This option is only supported on wearables.
- stickyradius
-
- <length>
-
- 1000px
-
- No
-
- Radius of the arc for a sticky item on the wearable. If this attribute is not specified, the default radius is used. When sticky is set to none , this attribute setting is invalid.
-
-
clickeffect 5+
boolean
@@ -101,7 +87,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -132,7 +118,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
-## Event
+## Events
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
@@ -158,11 +144,11 @@ In addition to the events in [Universal Events](js-components-common-events.md)
-## Method
+## Methods
Methods in [Universal Methods](js-components-common-methods.md) are supported.
-## Example Code
+## Example
For details, see the [list example code](js-components-container-list.md#section24931424488).
diff --git a/en/application-dev/reference/arkui-js/js-components-container-list.md b/en/application-dev/reference/arkui-js/js-components-container-list.md
index b62c4a0e5548d14f260fceebe34b81d5d5ab8373..54d0630ae2437dc9fe3ce8bd2ec47bb57214e6ba 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-list.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-list.md
@@ -2,15 +2,15 @@
The **** component provides a list container that presents a series of list items arranged in a column with the same width. Lists support presentations of the same data in a multiple and coherent row style, for example, images and texts.
-## Permission List
+## Required Permissions
N/A
-## Child Component
+## Child Components
<[list-item](js-components-container-list-item-group.md)\> and <[list-item-group](js-components-container-list-item.md)\>
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -150,30 +150,6 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
default : not specified (following the theme) rect : rectangle round : circle
- itemscale
-
- boolean
-
- true
-
- No
-
- Whether to cancel the zoom-in and zoom-out effects of the focus. This attribute takes effect only on wearables and smart TVs.
- NOTE: This attribute takes effect only when columns is set to 1 .
-
-
-
- itemcenter
-
- boolean
-
- false
-
- No
-
- Whether there is always an item at the center of the cross axis of the view for the initialization page and a page after scrolling. This attribute applies only to wearables.
-
-
updateeffect
boolean
@@ -200,18 +176,6 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
- scrollvibrate
-
- boolean
-
- true
-
- No
-
- Whether the device vibrates when the list is scrolled. This attribute takes effect only for wearables.
- true : The device vibrates when the list is scrolled. false : The device does not vibrate when the list is scrolled.
-
-
initialindex
number
@@ -220,8 +184,8 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
No
- Item to be displayed at the start position of the viewport when the current list is loaded for the first time. The default value is 0 , indicating that the first item is displayed.
- The setting does not take effect in any of the following cases:
+ Item to be displayed at the start position of the viewport when the current list is loaded for the first time. The default value is 0 , indicating that the first item is displayed.
+ The setting does not take effect in any of the following cases:
The value you set is greater than the index of the last item. The initialoffset attribute is set. indexer or scrollpage is set to true .
@@ -250,7 +214,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -297,7 +261,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
- Item divider length. If this style is not set, the maximum length is the width of the main axis, and the actual length depends on the divider-origin parameter. This style is valid only when the divider attribute of the list is set to true .
+ Item divider length. If this style is not set, the maximum length is the width of the main axis, and the actual length depends on the divider-origin parameter. This style is valid only when the divider attribute of <list> is set to true .
divider-origin 5+
@@ -308,7 +272,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
- Item divider offset relative to the start point of the main axis. This style is valid only when the divider attribute of the list is set to true .
+ Item divider offset relative to the start point of the main axis. This style is valid only when the divider attribute of <list> is set to true .
flex-direction
@@ -410,7 +374,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
-## Event
+## Events
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
@@ -487,7 +451,7 @@ In addition to the events in [Universal Events](js-components-common-events.md)
-## Method
+## Methods
In addition to the methods in [Universal Methods](js-components-common-methods.md), the following events are supported.
@@ -586,7 +550,7 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
Type
- Mandatory/Optional
+ Mandatory
Default Value
@@ -657,62 +621,3 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
-
-## Example Code
-
-```
-
-
-
-
- {{$item.title}}
- {{$item.date}}
-
-
-
-```
-
-```
-// index.js
-export default {
- data: {
- todolist: [{
- title: 'Prepare for the interview',
- date: 'Dec 31, 2021 10:00:00',
- }, {
- title: 'Watch the movie',
- date: 'Dec 31, 2021 20:00:00',
- }],
- },
-}
-```
-
-```
-/* index.css */
-.container {
- display: flex;
- justify-content: center;
- align-items: center;
- left: 0px;
- top: 0px;
- width: 454px;
- height: 454px;
-}
-.todo-wrapper {
- width: 454px;
- height: 300px;
-}
-.todo-item {
- width: 454px;
- height: 80px;
- flex-direction: column;
-}
-.todo-title {
- width: 454px;
- height: 40px;
- text-align: center;
-}
-```
-
-![](figures/33-30.png)
-
diff --git a/en/application-dev/reference/arkui-js/js-components-container-panel.md b/en/application-dev/reference/arkui-js/js-components-container-panel.md
index 049e0d5f647eadec0b2f695da6cbddbb8885474b..6d45f57ae91364b353ffbf8874aee8027b36a297 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-panel.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-panel.md
@@ -2,14 +2,11 @@
The **** component is a slidable panel. It provides a lightweight content display window with flexible sizes. The **** component pops up when it is displayed.
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->This component is supported since API version 5.
-
-## Child Component
+## Child Components
Yes
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -107,7 +104,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
>- Rendering attributes, including **for**, **if**, and **show**, are not supported.
>- The **focusable** and **disabled** attributes are not supported.
-## Style
+## Styles
Only the following style attributes are supported.
@@ -393,13 +390,13 @@ Only the following style attributes are supported.
No
- Transparency of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent.
+ Opacity of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent.
-## Event
+## Events
The following events are supported.
@@ -428,7 +425,7 @@ The following events are supported.
-## Method
+## Methods
Only the following methods are supported.
@@ -458,7 +455,7 @@ Only the following methods are supported.
-## Example Code
+## Example
```
diff --git a/en/application-dev/reference/arkui-js/js-components-container-popup.md b/en/application-dev/reference/arkui-js/js-components-container-popup.md
index 784e9ac5cede7b7f491f0c9ddb5bccb6f45942c1..dc2baeeb728ab71e6662ef5ca87c35b8465a5560 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-popup.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-popup.md
@@ -2,15 +2,15 @@
The **** component is used to display a pop-up to offer instructions after a user clicks a bound control.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
All child components are supported. Each **** can have only one child component5+ .
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -91,7 +91,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
>- The **focusable** attribute is not supported.
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -125,7 +125,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
>- Position-related styles are not supported.
-## Event
+## Events
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
@@ -148,7 +148,7 @@ In addition to the events in [Universal Events](js-components-common-events.md)
-## Method
+## Methods
Only the following methods are supported.
diff --git a/en/application-dev/reference/arkui-js/js-components-container-refresh.md b/en/application-dev/reference/arkui-js/js-components-container-refresh.md
index 3bba3f740b390b2b45da5f8dfbc4b83f1c3479c3..d428fe32b243f25b76cd92bd7c9e88a221d166bd 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-refresh.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-refresh.md
@@ -2,15 +2,15 @@
The **** component is used to pull down to refresh the page.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
Supported
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -99,7 +99,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -141,7 +141,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
-## Event
+## Events
The following events are supported.
@@ -173,7 +173,7 @@ The following events are supported.
-## Method
+## Methods
Methods in [Universal Methods](js-components-common-methods.md) are not supported.
diff --git a/en/application-dev/reference/arkui-js/js-components-container-stack.md b/en/application-dev/reference/arkui-js/js-components-container-stack.md
index 8bce30af1c6222adfa4e09b7b8d0fe9ace958579..af594dff35489a9a490560c71a4cc8097be15209 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-stack.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-stack.md
@@ -2,31 +2,31 @@
The **** component provides a stack container where child components are successively stacked and the latter one overwrites the previous one.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
Supported
-## Attribute
+## Attributes
Attributes in [Universal Attributes](js-components-common-attributes.md) are supported.
-## Style
+## Styles
Styles in [Universal Styles](js-components-common-styles.md) are supported.
-## Event
+## Events
Events in [Universal Events](js-components-common-events.md) are supported.
-## Method
+## Methods
Methods in [Universal Methods](js-components-common-methods.md) are supported.
-## Example Code
+## Example
```
diff --git a/en/application-dev/reference/arkui-js/js-components-container-stepper-item.md b/en/application-dev/reference/arkui-js/js-components-container-stepper-item.md
index a00b5fc0ff63b1a93098e705c4919dba5379023a..07fc38fb979720ac7d4193522d15cb7d42e8cef3 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-stepper-item.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-stepper-item.md
@@ -2,18 +2,15 @@
The **** component displays a step in the step navigator. This component is the child component of ****.
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->This component is supported since API version 5.
-
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
Supported
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -90,7 +87,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -171,7 +168,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
- Text modifier. Available values are as follows:
+ Text decoration. Available values are as follows:
underline : An underline is used. line-through : A strikethrough is used. none : The standard text is used.
@@ -193,7 +190,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
>- Height and width styles are not supported. The width of each item is the same as that of its container. The height of each item is the difference between the container height and the bottom button height.
>- The **posit** style is not supported.
-## Event
+## Events
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
@@ -223,11 +220,11 @@ In addition to the events in [Universal Events](js-components-common-events.md)
-## Method
+## Methods
Methods in [Universal Methods](js-components-common-methods.md) are not supported.
-## Example Code
+## Example
For details, see the [stepper example code](js-components-container-stepper.md).
diff --git a/en/application-dev/reference/arkui-js/js-components-container-stepper.md b/en/application-dev/reference/arkui-js/js-components-container-stepper.md
index 0be5a62ac4fbe1a19ca741f2f9bb25a35aaf0b79..1941dfbf7e419f70d16b6869c91c71822aed6b08 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-stepper.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-stepper.md
@@ -2,21 +2,18 @@
The **** component provides a step navigator. When multiple steps are required to complete a task, you can use the **** component to navigate your users through the whole process.
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->This component is supported since API version 5.
-
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
Only the **** component is supported.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
>Steps in the **** are sorted according to the sequence of its **** child components.
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -43,14 +40,14 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
Styles in [Universal Styles](js-components-common-styles.md) are supported.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
>By default, the **** component fills entire space of its container. To optimize user experience, it is recommended that the container should be as large as the application window in size, or should be the root component.
-## Event
+## Events
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
@@ -101,7 +98,7 @@ In addition to the events in [Universal Events](js-components-common-events.md)
-## Method
+## Methods
In addition to the methods in [Universal Methods](js-components-common-methods.md), the following events are supported.
@@ -125,7 +122,7 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
-## Example Code
+## Example
```
diff --git a/en/application-dev/reference/arkui-js/js-components-container-swiper.md b/en/application-dev/reference/arkui-js/js-components-container-swiper.md
index 9e965577a4ef1e2b126dd9c43af517811b7a616b..2070bfb323bd72c43c663601c5bf74435565728e 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-swiper.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-swiper.md
@@ -2,15 +2,15 @@
The **** component provides a container that allows users to switch among child components by swiping operations.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
All child components except **** are supported.
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -84,19 +84,6 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
- indicatormask
-
- boolean
-
- false
-
- No
-
- Whether to use the indicator mask. If this attribute is set to true , the indicator has a gradient mask.
- NOTE: This attribute does not take effect for smartphones. 5+
-
-
-
indicatordisabled 5+
boolean
@@ -169,7 +156,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -255,7 +242,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
-## Event
+## Events
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
@@ -292,7 +279,7 @@ In addition to the events in [Universal Events](js-components-common-events.md)
-## Method
+## Methods
In addition to the methods in [Universal Methods](js-components-common-methods.md), the following events are supported.
@@ -329,7 +316,7 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
-## Example Code
+## Example
```
@@ -414,5 +401,5 @@ export default {
}
```
-![](figures/4-31.gif)
+![](figures/4-0.gif)
diff --git a/en/application-dev/reference/arkui-js/js-components-container-tab-bar.md b/en/application-dev/reference/arkui-js/js-components-container-tab-bar.md
index 3abf5f747646e5e81d824ebabaa31cbb005f2f5a..da8e5ce58aedff5c24c26a444fd85a435c45b1ee 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-tab-bar.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-tab-bar.md
@@ -2,15 +2,15 @@
**** is a child component of **<[tabs](js-components-container-tabs.md)\>** and is used to provide the area to display tab labels. Its child components are horizontally arranged.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
Supported
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -42,19 +42,19 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
Styles in [Universal Styles](js-components-common-styles.md) are supported.
-## Event
+## Events
Events in [Universal Events](js-components-common-events.md) are supported.
-## Method
+## Methods
Methods in [Universal Methods](js-components-common-methods.md) are supported.
-## Example Code
+## Example
For details, see the [tabs example code](js-components-container-tabs.md#section14993155318710).
diff --git a/en/application-dev/reference/arkui-js/js-components-container-tab-content.md b/en/application-dev/reference/arkui-js/js-components-container-tab-content.md
index 9a91eca94716adc1bafbad61a7068d8ec28dccae..7de7d1f55296d9e1a1358e147d61e9e66d32a137 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-tab-content.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-tab-content.md
@@ -2,15 +2,15 @@
**** is a child component of [](js-components-container-tabs.md) and is used to provide the area for displaying the tab content. By default, its height is such that all the remaining space of the **** component is filled. The child components are arranged horizontally. When **** is used as a child element in a container, the length on the main axis direction must be specified. Otherwise, the child element cannot be displayed.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
Supported
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -41,15 +41,15 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
Styles in [Universal Styles](js-components-common-styles.md) are supported.
-## Event
+## Events
Events in [Universal Events](js-components-common-events.md) are supported.
-## Example Code
+## Example
For details, see the [tabs example code](js-components-container-tabs.md#section14993155318710).
diff --git a/en/application-dev/reference/arkui-js/js-components-container-tabs.md b/en/application-dev/reference/arkui-js/js-components-container-tabs.md
index 760b6269a6775dbc020700b3c3db392fed0bfb2f..7e9c8e9a4ef41133cb7889eaf4e36a286145c152 100644
--- a/en/application-dev/reference/arkui-js/js-components-container-tabs.md
+++ b/en/application-dev/reference/arkui-js/js-components-container-tabs.md
@@ -2,15 +2,15 @@
The **** component provides a tab container.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
A **** can wrap at most one **<[tab-bar](js-components-container-tab-bar.md)\>** and at most one **<[tab-content](js-components-container-tab-content.md)\>**.
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -53,11 +53,11 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
Styles in [Universal Styles](js-components-common-styles.md) are supported.
-## Event
+## Events
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
@@ -82,7 +82,7 @@ In addition to the events in [Universal Events](js-components-common-events.md)
-## Example Code
+## Example
```
diff --git a/en/application-dev/reference/arkui-js/js-components-custom-basic-usage.md b/en/application-dev/reference/arkui-js/js-components-custom-basic-usage.md
index 0afdff1d1d9fbf7902ae02df9c6d09d47932aebf..8ea11f6fb9fa1026c6e51ff87efddd8779f32d54 100644
--- a/en/application-dev/reference/arkui-js/js-components-custom-basic-usage.md
+++ b/en/application-dev/reference/arkui-js/js-components-custom-basic-usage.md
@@ -27,37 +27,37 @@ The following is an example of using a custom component with **if-else**:
>For child component events that are named in camel case, convert the names to kebab case when binding the events to the parent component. For example, use **@children-event** instead of **childrenEvent**: **@children-event="bindParentVmMethod"**.
-## Object
+**Table 1** Objects
- Attribute
+ Attribute
- Type
+ Type
- Description
+ Description
- data
+ data
- Object/Function
+ Object/Function
- Data model of the page. If the attribute is of the function type, the return value must be of the object type. The attribute name cannot start with the dollar sign ($) or underscore (_). Do not use reserved words ( for , if , show , and tid ).
- Do not use this attribute and private or public at the same time
+ Data model of the page. If the attribute is of the function type, the return value must be of the object type. The attribute name cannot start with a dollar sign ($) or underscore (_). Do not use reserved words ( for , if , show , and tid ).
+ Do not use this attribute and private or public at the same time. (Rich)
- props
+ props
- Array/Object
+ Array/Object
- Used for communication between components. This attribute can be transferred to components via <tag xxxx='value'> . A props name must be in lowercase and cannot start with dollar sign ($) or underscore (_). Do not use reserved words ( for , if , show , and tid ). Currently, props does not support functions.
+ Used for communication between components. This attribute can be transferred to components via <tag xxxx='value'> . A props name must be in lowercase and cannot start with a dollar sign ($) or underscore (_). Do not use reserved words ( for , if , show , and tid ). Currently, props does not support functions.
- computed
+ computed
- Object
+ Object
- Used for pre-processing an expression for reading and setting. The result is cached. The name cannot start with a dollar sign ($) or underscore (_). Do not use reserved words.
+ Used for pre-processing an object for reading and setting. The result is cached. The name cannot start with a dollar sign ($) or underscore (_). Do not use reserved words.
diff --git a/en/application-dev/reference/arkui-js/js-components-custom-lifecycle.md b/en/application-dev/reference/arkui-js/js-components-custom-lifecycle.md
index ae892a75a546db5133c92591743549cb591fd136..fcadfdd427267b239e3f8660a7eca2b3bece1119 100644
--- a/en/application-dev/reference/arkui-js/js-components-custom-lifecycle.md
+++ b/en/application-dev/reference/arkui-js/js-components-custom-lifecycle.md
@@ -1,7 +1,7 @@
# Lifecycle Definition
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->This component is supported since API version 5.
+>This component is supported since API version 5. Updates will be marked with a superscript to indicate their earliest API version.
We provide a range of lifecycle callbacks for custom components, including **onInit**, **onAttached**, **onDetached**, **onLayoutReady**, **onDestroy**, **onPageShow**, and **onPageHide**. You can use these callbacks to manage the internal logic of your custom components. The following describes the times when the lifecycle callbacks are invoked.
diff --git a/en/application-dev/reference/arkui-js/js-components-custom-props.md b/en/application-dev/reference/arkui-js/js-components-custom-props.md
index 3447328fbb5463cea57ef5c9ed4ebef100595bbe..f2a3a4c4faf87d3230de6d128c9c55ad20548f9d 100644
--- a/en/application-dev/reference/arkui-js/js-components-custom-props.md
+++ b/en/application-dev/reference/arkui-js/js-components-custom-props.md
@@ -1,4 +1,4 @@
-# Props
+# props
You can use **props** to declare attributes of a custom component and pass the attributes to the child component. The supported types of **props** include String, Number, Boolean, Array, Object, and Function. Note that a camel case attribute name \(**compProp**\) should be converted to the kebab case format \(**comp-prop**\) when you reference the attribute in an external parent component. You can add **props** to a custom component, and pass the attribute to the child component.
diff --git a/en/application-dev/reference/arkui-js/js-components-custom-slot.md b/en/application-dev/reference/arkui-js/js-components-custom-slot.md
index 34b14acd701527a60d2f44ac9d3790be7175be4a..b65cfd01d2603195100ed8c0709289dd7b59b692 100644
--- a/en/application-dev/reference/arkui-js/js-components-custom-slot.md
+++ b/en/application-dev/reference/arkui-js/js-components-custom-slot.md
@@ -1,7 +1,7 @@
# slot
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Default Slot
diff --git a/en/application-dev/reference/arkui-js/js-components-custom.md b/en/application-dev/reference/arkui-js/js-components-custom.md
index d6148b3a87b5fb6a52ea27b35a4dd89d8ffb33a3..496a31fd7ec670877c57c061d6d36e5847e54ce4 100644
--- a/en/application-dev/reference/arkui-js/js-components-custom.md
+++ b/en/application-dev/reference/arkui-js/js-components-custom.md
@@ -4,7 +4,7 @@
- **[Custom Events](js-components-custom-events.md)**
-- **[Props](js-components-custom-props.md)**
+- **[props](js-components-custom-props.md)**
- **[Event Parameter](js-components-custom-event-parameter.md)**
diff --git a/en/application-dev/reference/arkui-js/js-components-grid-basic-concepts.md b/en/application-dev/reference/arkui-js/js-components-grid-basic-concepts.md
index fe1a74bd0f9f9611eb4f9e44fcd8802a13c1cf13..892162f087443473485860796fa43f721967c15e 100644
--- a/en/application-dev/reference/arkui-js/js-components-grid-basic-concepts.md
+++ b/en/application-dev/reference/arkui-js/js-components-grid-basic-concepts.md
@@ -11,9 +11,6 @@ As a layout-auxiliary positioning tool, the grid system plays an essential role
3. Provides a flexible spacing adjustment method for applications to keep up with layout in special scenarios.
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->Grid components are supported since API version 5.
-
## Concepts
A column system contains of three attributes: margins, gutters, and columns.
@@ -44,4 +41,3 @@ A column system contains of three attributes: margins, gutters, and columns.
**lg**: 12 columns for 840 ≤ horizontal vp
-
diff --git a/en/application-dev/reference/arkui-js/js-components-grid-col.md b/en/application-dev/reference/arkui-js/js-components-grid-col.md
index 7fdf683b0938e5988008805a36ecfb62772403cd..91bfc7498c4fec9a2e30b7829250766d5f5b080e 100644
--- a/en/application-dev/reference/arkui-js/js-components-grid-col.md
+++ b/en/application-dev/reference/arkui-js/js-components-grid-col.md
@@ -1,16 +1,16 @@
-# grid-col
+# grid-col
The **** is the child component of the **** container.
-## Permission List
+## Required Permissions
-None
+None.
-## Child Component
+## Child Components
Supported
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -35,7 +35,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
No
- Number of columns occupied by this item and offset columns when sizetype is xs . If you set the value of the number type, you only set the number of occupied columns. You can set a value of the object type for both the number of occupied columns and offset columns, for example, {"span": 1, "offset": 0} .
+ Number of columns occupied by this item and offset columns when sizetype is xs . If you set the value of the number type, you only set the number of occupied columns. You can set a value of the object type for both the number of occupied columns and offset columns, for example, {"span": 1, "offset": 0} .
sm
@@ -46,7 +46,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
No
- Number of columns occupied by this item and offset columns when sizetype is sm . If you set the value of the number type, you only set the number of occupied columns. You can set a value of the object type for both the number of occupied columns and offset columns, for example, {"span": 1, "offset": 0} .
+ Number of columns occupied by this item and offset columns when sizetype is sm . If you set the value of the number type, you only set the number of occupied columns. You can set a value of the object type for both the number of occupied columns and offset columns, for example, {"span": 1, "offset": 0} .
md
@@ -57,7 +57,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
No
- Number of columns occupied by this item and offset columns when sizetype is md . If you set the value of the number type, you only set the number of occupied columns. You can set a value of the object type for both the number of occupied columns and offset columns, for example, {"span": 1, "offset": 0} .
+ Number of columns occupied by this item and offset columns when sizetype is md . If you set the value of the number type, you only set the number of occupied columns. You can set a value of the object type for both the number of occupied columns and offset columns, for example, {"span": 1, "offset": 0} .
lg
@@ -68,7 +68,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
No
- Number of columns occupied by this item and offset columns when sizetype is lg . If you set the value of the number type, you only set the number of occupied columns. You can set a value of the object type for both the number of occupied columns and offset columns, for example, {"span": 1, "offset": 0} .
+ Number of columns occupied by this item and offset columns when sizetype is lg . If you set the value of the number type, you only set the number of occupied columns. You can set a value of the object type for both the number of occupied columns and offset columns, for example, {"span": 1, "offset": 0} .
span
@@ -90,13 +90,13 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
No
- Default number of offset columns in the container layout direction when "offset" is not set for a specific sizetype .
+ Default number of offset columns in the container layout direction when "offset" is not set for a specific sizetype .
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -122,7 +122,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
Main axis direction of the container. Available values are as follows:
- column : Items are placed vertically from top to bottom. row : Items are placed horizontally from left to right.
+ column : Items are placed vertically from top to bottom. row : Items are placed horizontally from left to right.
flex-wrap
@@ -134,7 +134,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
Whether items in the container are displayed in a single axis or multiple axes. Currently, dynamic modification is not supported. Available values are as follows:
- nowrap : Items are displayed on a single axis. wrap : Items are displayed on multiple axes.
+ nowrap : Items are displayed on a single axis. wrap : Items are displayed on multiple axes.
justify-content
@@ -146,7 +146,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
How items are aligned along the main axis of the current row in the container. Available values are as follows:
- flex-start : Items are packed towards the start row. flex-end : Items are packed towards the end row. center : Items are centered along the row. space-between : Items are positioned with space between the rows. space-around : Items are positioned with space before, between, and after the rows.
+ flex-start : Items are packed towards the start row. flex-end : Items are packed towards the end row. center : Items are centered along the row. space-between : Items are positioned with space between the rows. space-around : Items are positioned with space before, between, and after the rows.
align-items
@@ -158,7 +158,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
How items are aligned along the cross axis of the current row in the container. Available values are as follows:
- stretch : Items are stretched to the same height or width as the container in the cross axis direction. flex-start : Items are aligned to the start of the cross axis. flex-end : Items are aligned to the end of the cross axis. center : Items are aligned in the middle of the cross axis.
+ stretch : Items are stretched to the same height or width as the container in the cross axis direction. flex-start : Items are aligned to the start of the cross axis. flex-end : Items are aligned to the end of the cross axis. center : Items are aligned in the middle of the cross axis.
align-content
@@ -170,7 +170,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
Multi-row alignment mode when there is extra space in the cross axis. Available values are as follows:
- flex-start : All rows are packed towards the start of the cross axis. The start edge of the cross axis of the first row is aligned with the start edge of the cross axis of the container. All subsequent rows are aligned with the previous row. flex-end : All rows are packed towards the end of the cross axis. The end of the cross axis of the last row is aligned with the end of the cross axis of the container. All subsequent rows are aligned with the previous row. center : All rows are packed towards the center of the container. Rows are close to each other and aligned with the center of the container. The spacing between the start of the container's cross axis and the first row is equal to the spacing between the end of the container's cross axis and the last row. space-between : All rows are evenly distributed in the container. The spacing between two adjacent rows is the same. The start and end edges of the container's cross axis are aligned with the edges of the first and last rows, respectively. space-around : All rows are evenly distributed in the container, and the spacing between two adjacent rows is the same. The spacing between the start edge of the container's cross axis and the first row and that between the end edge and the last row are half of the spacing between two adjacent rows.
+ flex-start : All rows are packed towards the start of the cross axis. The start edge of the cross axis of the first row is aligned with the start edge of the cross axis of the container. All subsequent rows are aligned with the previous row. flex-end : All rows are packed towards the end of the cross axis. The end of the cross axis of the last row is aligned with the end of the cross axis of the container. All subsequent rows are aligned with the previous row. center : All rows are packed towards the center of the container. Rows are close to each other and aligned with the center of the container. The spacing between the start of the container's cross axis and the first row is equal to the spacing between the end of the container's cross axis and the last row. space-between : All rows are evenly distributed in the container. The spacing between two adjacent rows is the same. The start and end edges of the container's cross axis are aligned with the edges of the first and last rows, respectively. space-around : All rows are evenly distributed in the container, and the spacing between two adjacent lines is the same. The spacing between the start edge of the container's cross axis and the first row and that between the end edge and the last row are half of the spacing between two adjacent rows.
display
@@ -181,8 +181,8 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
- Type of the view box of the element. Currently, dynamic modification is not supported. Text alignment mode. Available values include:
- flex : flexible layout grid : grid layout none : This item is not rendered.
+ Type of the view box of the element. Currently, dynamic modification is not supported. Available values are as follows:
+ flex : flexible layout. grid : grid layout. none : disabled.
grid-template-[columns|rows]
@@ -193,13 +193,13 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
- Number of rows and columns in the current grid layout. If this attribute is not set, one row and one column are displayed by default. This attribute is valid only when display is set to grid .
- For example, set grid-template-columns to:
- (1) 50px 100px 60px : There are three columns. The first column is 50 px, the second column is 100 px, and the third column is 60 px.
- (2) 1fr 1fr 2fr : There are three columns, and the width allowed by the parent component is divided into four equal shares. The first column occupies one share, the second column occupies one share, and the third column occupies two shares.
- (3) 30% 20% 50% : There are three columns. The first column occupies 30% of the total width allowed by the parent component, the second column occupies 20%, and the third column occupies 50%.
- (4) repeat (2,100px) : There are two columns. The first column is 100 px, and the second column is 100 px.
- (5) auto 1fr 1fr : There are three columns. The first column is adaptive to the width required by its child components. The remaining space is divided into two equal shares, one share occupied by each of the two columns.
+ Number of rows and columns in the current grid layout. If this attribute is not set, one row and one column are displayed by default. This attribute is valid only when display is set to grid .
+ For example, set grid-template-columns to:
+ (1) 50px 100px 60px : There are three columns. The first column is 50 px, the second column is 100 px, and the third column is 60 px.
+ (2) 1fr 1fr 2fr : There are three columns, and the width allowed by the parent component is divided into four equal shares. The first column occupies one share, the second column occupies one share, and the third column occupies two shares.
+ (3) 30% 20% 50% : There are three columns. The first column occupies 30% of the total width allowed by the parent component, the second column occupies 20%, and the third column occupies 50%.
+ (4) repeat (2,100px) : There are two columns. The first column is 100 px, and the second column is 100 px.
+ (5) auto 1fr 1fr : There are three columns. The first column is adaptive to the width required by its child components. The remaining space is divided into two equal shares, one share occupied by each of the two columns.
grid-[columns|rows]-gap
@@ -210,7 +210,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
- Size of the gap between two consecutive rows or columns in a grid layout. You can also use grid-gap to set the same size of the gap between rows and columns. This attribute is valid only when display is set to grid .
+ Size of the gap between two consecutive rows or columns in a grid layout. You can also use grid-gap to set the same size of the gap between rows and columns. This attribute is valid only when display is set to grid .
grid-row-[start|end]
@@ -221,7 +221,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
- Start and end row numbers of the current item in the grid layout. This attribute is valid only when display of the parent component is grid . (The display attribute of the parent component can be set to grid only for the <div> container.)
+ Start and end row numbers of the current item in the grid layout. This attribute is valid only when display of the parent component is grid . (The display attribute of the parent component can be set to grid only for the <div> container.)
grid-column-[start|end]
@@ -232,36 +232,36 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
No
- Start and end column numbers of the current item in the grid layout. This attribute is valid only when display of the parent component is grid . (The display attribute of the parent component can be set to grid only for the <div> container.)
+ Start and end column numbers of the current item in the grid layout. This attribute is valid only when display of the parent component is grid . (The display attribute of the parent component can be set to grid only for the <div> container.)
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- Width-related styles are not supported.
+>Width-related styles are not supported.
-## Event
+## Events
Events in [Universal Events](js-components-common-events.md) are supported.
-## Method
+## Methods
Methods in [Universal Methods](js-components-common-methods.md) are supported.
-## Example Code
+## Example
```
-
+
Element text
-
+
Element text
@@ -302,3 +302,5 @@ export default {
}
```
+![](figures/grid.gif)
+
diff --git a/en/application-dev/reference/arkui-js/js-components-grid-container.md b/en/application-dev/reference/arkui-js/js-components-grid-container.md
index 8f3d7dfbeabd71c07d1ffc46417c23d469b44a98..9bec017c1a2eb9018b69108c352b300a43055671 100644
--- a/en/application-dev/reference/arkui-js/js-components-grid-container.md
+++ b/en/application-dev/reference/arkui-js/js-components-grid-container.md
@@ -1,8 +1,8 @@
# grid-container
-The **** component is the root container of the grid layout. Within the root container, you can use **** and **** for the grid layout.
+The **** component is the root container of the grid layout. Within the root container, you can use **** and **** for the grid layout.
-## Permission List
+## Required Permissions
None
@@ -10,7 +10,7 @@ None
Only the **** component is supported.
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -166,9 +166,10 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>
>- The px unit is applicable when **autoDesignWidth** is set to **true** in the "js" tag. 6+
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -224,7 +225,7 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
-## Event
+## Events
Events in [Universal Events](js-components-common-events.md) are supported.
@@ -274,5 +275,5 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
## Example Code
-For details, see [grid-col](js-components-grid-col.md#section2021865273710).
+For details, see [grid-col](js-components-grid-col.md).
diff --git a/en/application-dev/reference/arkui-js/js-components-grid-row.md b/en/application-dev/reference/arkui-js/js-components-grid-row.md
index 1c78364c375225442cc8a0496ffd38766a055000..ffb31abdb1fa5fdfad533a54cd47e8a5bc75dae5 100644
--- a/en/application-dev/reference/arkui-js/js-components-grid-row.md
+++ b/en/application-dev/reference/arkui-js/js-components-grid-row.md
@@ -2,19 +2,19 @@
The **** component is a container used as a child component of ****. Each **** component is arranged horizontally with **flex**-related styles. By default, items in the **** component are packed towards the start row and aligned to the start of the cross axis. You can set the items to be displayed in multiple axes.
-## Permission List
+## Required Permissions
None
-## Child Component
+## Child Components
Only the **** component is supported.
-## Attribute
+## Attributes
Attributes in [Universal Attributes](js-components-common-attributes.md) are supported.
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -83,17 +83,17 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- Width-related styles are not supported.
+>Width-related styles are not supported.
-## Event
+## Events
Events in [Universal Events](js-components-common-events.md) are supported.
-## Method
+## Methods
Methods in [Universal Methods](js-components-common-methods.md) are supported.
## Example Code
-For details, see [grid-col](js-components-grid-col.md#section2021865273710).
+For details, see [grid-col](js-components-grid-col.md).
diff --git a/en/application-dev/reference/arkui-js/js-components-media-video.md b/en/application-dev/reference/arkui-js/js-components-media-video.md
index 220b54e07b4fa6e8e8ad746526bb4841ebf3fe54..1e2b132c923351e37d92eafeea3bf71ef34d3fb1 100644
--- a/en/application-dev/reference/arkui-js/js-components-media-video.md
+++ b/en/application-dev/reference/arkui-js/js-components-media-video.md
@@ -8,13 +8,13 @@ The **** component provides a video player.
> "configChanges": ["orientation"]
> ```
-## Permission List
+## Required Permissions
## Child Component
Not supported
-## Attribute
+## Attributes
In addition to the attributes in [Universal Attributes](js-components-common-attributes.md), the following attributes are supported.
@@ -78,7 +78,7 @@ In addition to the attributes in [Universal Attributes](js-components-common-at
-## Style
+## Styles
In addition to the styles in [Universal Styles](js-components-common-styles.md), the following styles are supported.
@@ -126,14 +126,14 @@ In addition to the styles in [Universal Styles](js-components-common-styles.md)
-## Event
+## Events
In addition to the events in [Universal Events](js-components-common-events.md), the following events are supported.
Name
- Parameter Type
+ Parameter
Description
@@ -198,14 +198,14 @@ In addition to the events in [Universal Events](js-components-common-events.md)
-## Method
+## Methods
-In addition to the methods in [Universal Methods](js-components-common-methods.md), the following events are supported.
+In addition to the methods in [Universal Methods](js-components-common-methods.md), the following methods are supported.
Name
- Parameter Type
+ Type
Description
@@ -235,3 +235,6 @@ In addition to the methods in [Universal Methods](js-components-common-methods.
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>The methods in the above table can be called after the **attached** callback is invoked.
+
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-animate.md b/en/application-dev/reference/arkui-js/js-components-svg-animate.md
index 24b10e8f27bf7b57f435aa7855e2c694bfe3ea79..751dbe4adb724775bc0cd287b47f29c25cbd2339 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-animate.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-animate.md
@@ -3,9 +3,9 @@
The **** component is used to apply animation to an **** component.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
@@ -221,7 +221,7 @@ Not supported
```
-![](figures/1-45.gif)
+![](figures/1-10.gif)
```
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-animatemotion.md b/en/application-dev/reference/arkui-js/js-components-svg-animatemotion.md
index 8ce363a1cf6fec0975df169d4ec543ed92258bc6..ab8d768fbd7e9333c4876dea209c88da6de576e1 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-animatemotion.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-animatemotion.md
@@ -1,11 +1,11 @@
# animateMotion
-The **** component is used to apply the path animation.
+The **** component is used to define the animation along a path.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
@@ -90,5 +90,5 @@ The **animate** attributes \(**values** does not take effect\) and the attrib
```
-![](figures/2-46.gif)
+![](figures/2-11.gif)
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md b/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md
index 6e43e82e616a1af9645cbc1ccc5d3a27a6d73b0c..4b4cf63bcb25cd7e8a7abc010ae91af3bb308ad6 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md
@@ -5,9 +5,9 @@ The **** component is used to apply a transform animation a
, , , , , , ,
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-circle.md b/en/application-dev/reference/arkui-js/js-components-svg-circle.md
index 2289e069d8cd798c0a03f17e1dfb4737a9a5b708..b83f3c4e8f25a788f4e10c9b5302390df983297a 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-circle.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-circle.md
@@ -3,9 +3,9 @@
The **** component is used to draw circles.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
@@ -15,7 +15,7 @@ None
## Attributes
-The universal attributes as well as the attributes listed below are supported.
+The [universal attributes](js-components-svg-common-attributes.md) and the attributes listed below are supported.
Name
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-common-attributes.md b/en/application-dev/reference/arkui-js/js-components-svg-common-attributes.md
index 8d192ead2f2f1ebcc560f569e1e68591b9bc9768..41708e4000c2be922448df292ce6cb1fad608f69 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-common-attributes.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-common-attributes.md
@@ -1,5 +1,8 @@
# Universal Attributes
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>Universal attributes are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
Name
@@ -32,7 +35,7 @@
No
- Transparency of a fill color. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
+ Opacity of a fill color. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
fill-rule
@@ -43,7 +46,7 @@
No
- nonzero : non-zero rule; evend : parity rule.
+ nonzero : non-zero rule; evenodd : parity rule.
opacity
@@ -54,7 +57,7 @@
No
- Transparency of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
+ Opacity of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
stroke
@@ -137,7 +140,7 @@
No
- Transparency of the stroke. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
+ Opacity of the stroke. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
stroke-width
@@ -165,7 +168,7 @@
scale(<x> [<y>]) : scales along the x[y]-axis.
rotate(<a> [<x> <y>]) : rotates at an angle of a with (x,y) as the center.
skewX(<a>) : skews at an angle of a along the x-axis.
- skewX(<a>) : skews at an angle of a along the y-axis.
+ skewY(<a>) : skews at an angle of a along the y-axis.
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-ellipse.md b/en/application-dev/reference/arkui-js/js-components-svg-ellipse.md
index 703d575f888644cdfff1f4d0a4f7063049a554cf..26e2940fc0d631b63c6713b0e8f162478866081c 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-ellipse.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-ellipse.md
@@ -3,9 +3,9 @@
The **** component is used to draw oval shapes.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
@@ -15,7 +15,7 @@ None
## Attributes
-The universal attributes as well as the attributes listed below are supported.
+The [universal attributes](js-components-svg-common-attributes.md) and the attributes listed below are supported.
Name
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-line.md b/en/application-dev/reference/arkui-js/js-components-svg-line.md
index 248eedba9b85be7cb1ec8af29a6617711ce101c8..6ec9f30e742e29c148f4e312afcc31feb6c55bea 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-line.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-line.md
@@ -3,9 +3,9 @@
The **** component is used to draw a line.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-path.md b/en/application-dev/reference/arkui-js/js-components-svg-path.md
index 1797813f8b1e8ed6ec386dcb72f5b5fb93950399..a6f78eca6161b55eb5fed2fcf4ae624bd8199953 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-path.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-path.md
@@ -3,9 +3,9 @@
The **** component is used to draw a path.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
@@ -15,7 +15,7 @@ None
## Attributes
-The universal attributes as well as the attributes listed below are supported. The configured universal attributes are passed to the child components.
+The [universal attributes](js-components-svg-common-attributes.md) and the attributes listed below are supported. The configured universal attributes are passed to the child components.
Name
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-polygon.md b/en/application-dev/reference/arkui-js/js-components-svg-polygon.md
index 7c63ed5f485e874c116621dffbff91c1504a3fbd..378be8a30a6fa4a0124d113a64b2eead3b19a79a 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-polygon.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-polygon.md
@@ -3,9 +3,9 @@
The **** component is used to draw a polygon.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
@@ -15,7 +15,7 @@ None
## Attributes
-The universal attributes as well as the attributes listed below are supported.
+The [universal attributes](js-components-svg-common-attributes.md) and the attributes listed below are supported.
Name
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-polyline.md b/en/application-dev/reference/arkui-js/js-components-svg-polyline.md
index 7929ec53824520ec869d851a8b071371b1e0c3a5..ddefca98447ae302fa9036bec278c8d1ebc46c85 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-polyline.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-polyline.md
@@ -3,9 +3,9 @@
The **** component is used to draw a polyline.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-rect.md b/en/application-dev/reference/arkui-js/js-components-svg-rect.md
index d713d24739f398437e9d1411a0d1a9fab70f3e57..1b9ee69bba4ff67d311a08d6910b4d84cf03c472 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-rect.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-rect.md
@@ -3,9 +3,9 @@
The **** component is used to draw rectangles and rounded rectangles.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-## Permission List
+## Required Permissions
None
@@ -15,7 +15,7 @@ None
## Attributes
-The universal attributes as well as the attributes listed below are supported.
+The [universal attributes](js-components-svg-common-attributes.md) and the attributes listed below are supported.
Name
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-text.md b/en/application-dev/reference/arkui-js/js-components-svg-text.md
index 6dee791d248041af39925b9440c1152e1552a86b..4b9887758b264f6c9134537190ed62dae5751d83 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-text.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-text.md
@@ -3,12 +3,12 @@
The **** component is used to display a piece of textual information.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- The APIs of this module are supported since API version 7.
+>- This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
>- The text content must be written in the content area. The **tspan** sub-element label can be nested to segment the text content. The **textPath** sub-element label can be nested to draw the text content based on the specified path.
>- **** can be nested only by the parent element label **svg**.
>- Only the default font **sans-serif** is supported.
-## Permission List
+## Required Permissions
None
@@ -129,7 +129,7 @@ The attributes in the following table are supported.
No
- Font fill transparency.
+ Font fill opacity.
opacity
@@ -140,7 +140,7 @@ The attributes in the following table are supported.
No
- Transparency of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
+ Opacity of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
stroke
@@ -173,7 +173,7 @@ The attributes in the following table are supported.
No
- Stroke transparency.
+ Stroke opacity.
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-textpath.md b/en/application-dev/reference/arkui-js/js-components-svg-textpath.md
index c00f7cb560bbea41ef5331e268492b87d191052b..6ecd8c2df6f5b7917c24f06f5da354a9d597f334 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-textpath.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-textpath.md
@@ -3,11 +3,11 @@
The **** component is used to draw text along the path.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- The APIs of this module are supported since API version 7.
+>- This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
>- Draws text based on the specified path. The **tspan** child component can be nested for segmenting.
>- **** can be nested only by the parent element label **svg**.
-## Permission List
+## Required Permissions
None
@@ -89,6 +89,17 @@ The attributes in the following table are supported.
Font fill color.
+ by
+
+ number
+
+ -
+
+ No
+
+ Attribute offset relative to the specified animation. The default value of from is the original attribute value.
+
+
opacity
number
@@ -97,7 +108,7 @@ The attributes in the following table are supported.
No
- Transparency of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
+ Opacity of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
fill-opacity
@@ -108,7 +119,7 @@ The attributes in the following table are supported.
No
- Font fill transparency.
+ Font fill opacity.
stroke
@@ -141,7 +152,7 @@ The attributes in the following table are supported.
No
- Stroke transparency.
+ Stroke opacity.
@@ -304,7 +315,7 @@ Animation and effect of the combination of **textpath** and **tspan**
\(1\) "tspan attribute x|rotate" indicates that the text drawing start point moves from 50 px to 100 px and rotates clockwise by 0 degrees to 360 degrees.
-\(2\) "tspan attribute dx|opacity" is drawn after the "tspan static." drawing is complete. The offset moves from 0% to 30%, and the transparency changes from shallow to deep.
+\(2\) "tspan attribute dx|opacity" is drawn after the "tspan static." drawing is complete. The offset moves from 0% to 30%, and the opacity changes from shallow to deep.
\(3\) **tspan move**: After the previous **tspan** is drawn, the next tspan is drawn with an offset of 5% to show the effect of following the previous **tspan**.
@@ -340,7 +351,7 @@ Animation and effect of the combination of **textpath** and **tspan**
\(1\) **This is TextPath**.: Draw the first paragraph of text on the path without offset. The size is 30px, and the color is "\#D2691E".
-\(2\) The value of **tspan attribute fill|fill-opacity** is 20px offset from the end of the previous text segment. The color is from blue to red, and the transparency is from light to deep.
+\(2\) The value of **tspan attribute fill|fill-opacity** is 20px offset from the end of the previous text segment. The color is from blue to red, and the opacity is from light to deep.
\(3\) **tspan attribute font-size**: The drawing start point is 20px offset from the end of the previous segment. The start point is static, and the font size ranges from 10px to 50px. The overall length is continuously prolonged.
@@ -377,5 +388,5 @@ Animation and effect of the combination of **textpath** and **tspan**
\(1\) **tspan attribute stroke**: The stroke color gradually changes from red to green.
-\(2\) **tspan attribute stroke-width-opacity**: The contour width is changed from 1px to 5px, and the transparency is changed from shallow to deep.
+\(2\) **tspan attribute stroke-width-opacity**: The contour width is changed from 1px to 5px, and the opacity is changed from shallow to deep.
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-tspan.md b/en/application-dev/reference/arkui-js/js-components-svg-tspan.md
index 173feb122d5e0d6d81eb6c503384bb87961f9ddc..a37f96069f116e394306edf9cbcef2f792f36019 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg-tspan.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg-tspan.md
@@ -1,11 +1,11 @@
# tspan
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- The APIs of this module are supported since API version 7.
+>- This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
>- The text content must be written in the content area. The **** child component can be nested.
>- **** can be nested only by the parent element label **svg**.
-## Permission List
+## Required Permissions
None
@@ -124,7 +124,7 @@ The attributes in the following table are supported.
No
- Transparency of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
+ Opacity of an element. The value ranges from 0 to 1 . The value 1 means opaque, and 0 means completely transparent. Attribute animations are supported.
fill-opacity
@@ -135,7 +135,7 @@ The attributes in the following table are supported.
No
- Font fill transparency.
+ Font fill opacity.
stroke
@@ -168,7 +168,7 @@ The attributes in the following table are supported.
No
- Stroke transparency.
+ Stroke opacity.
diff --git a/en/application-dev/reference/arkui-js/js-components-svg.md b/en/application-dev/reference/arkui-js/js-components-svg.md
index b8c870129351d66c777a7b8a4f0b07fefbdacdaa..83fdf3085c0e6268dc313ceaa6d7c26dc0220ac7 100644
--- a/en/application-dev/reference/arkui-js/js-components-svg.md
+++ b/en/application-dev/reference/arkui-js/js-components-svg.md
@@ -1,12 +1,12 @@
# svg
-**** is a basic container, which is used as the root node of the SVG and can be nested in the SVG.
+The **** component is a basic container. It can be used as the root node of an SVG document or be used to nest an SVG fragment into an SVG document.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
->Constraints: The width and height must be defined for the **** parent component or **** component. Otherwise, the component is not drawn.
+>- This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+>- The width and height must be defined for the **** parent component or **** component. Otherwise, the component is not drawn.
-## Permission List
+## Required Permissions
None
@@ -16,7 +16,7 @@ None
## Attributes
-The universal attributes as well as the attributes listed below are supported. The configured universal attributes are passed to the child components.
+The [universal attributes](js-components-svg-common-attributes.md) and the attributes listed below are supported. The configured universal attributes are passed to the child components.
Name
diff --git a/en/application-dev/reference/arkui-js/js-components.md b/en/application-dev/reference/arkui-js/js-components.md
index 775b92b37f0f963d68cb1d87ad7607c6f7a06c76..048e5afb46e3d8765ede56525ebe1de808b6ec48 100644
--- a/en/application-dev/reference/arkui-js/js-components.md
+++ b/en/application-dev/reference/arkui-js/js-components.md
@@ -8,10 +8,9 @@
- **[Media Components](js-components-media.md)**
-- **[Canvas Components \(Rich\)](js-components-canvas.md)**
+- **[Canvas Components ](js-components-canvas.md)**
- **[Grid](js-components-grid.md)**
- **[SVG Components](js-svg.md)**
-
diff --git a/en/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md b/en/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md
index 524f685ba59c096159811425aedfa3c2a94d5d43..0eaa85d778d22dd9395c16f40d45ec60284bc469 100644
--- a/en/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md
+++ b/en/application-dev/reference/arkui-js/js-offscreencanvasrenderingcontext2d.md
@@ -1,16 +1,17 @@
# OffscreenCanvasRenderingContext2D
+
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The APIs of this module are supported since API version 7.
+>**OffscreenCanvasRenderingContext2D** is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
-Use **OffscreenCanvasRenderingContext2D** to draw rectangles, images, and texts on the offscreen canvas.
+Use **OffscreenCanvasRenderingContext2D** to draw rectangles, images, and texts on an **OffscreenCanvas**.
## Attributes
In addition to the attributes that are supported by **CanvasRenderingContext2D**, the following attributes are supported.
- Attributes
+ Name
Type
@@ -24,7 +25,7 @@ In addition to the attributes that are supported by **CanvasRenderingContext2D*
Image filter.
Available options are as follows:
- blur : applies the Gaussian blur for the image. brightness : applies a linear multiplication to the image to make it look brighter or darker. contrast : adjusts the image contrast. drop-shadow : sets a shadow effect for the image. grayscale : converts the image to a grayscale image. hue-rotate : applies hue rotation to the image. invert : inverts the input image. opacity : transparency of the converted image. saturation : saturation of the converted image. sepia : converts the image to dark brown.
+ blur : applies the Gaussian blur for the image. brightness : applies a linear multiplication to the image to make it look brighter or darker. contrast : adjusts the image contrast. drop-shadow : sets a shadow effect for the image. grayscale : converts the image to a grayscale image. hue-rotate : applies hue rotation to the image. invert : inverts the input image. opacity : opacity of the converted image. saturate : saturation of the converted image. sepia : converts the image to dark brown.
@@ -32,179 +33,306 @@ In addition to the attributes that are supported by **CanvasRenderingContext2D*
- Example
-```
-var ctx = this.$refs.canvasid.getContext('2d');
-var offscreen = new OffscreenCanvas(360, 500);
-var offCanvas2 = offscreen.getContext("2d");
-var img = new Image();
-img.src = 'common/images/flower.jpg';
-offCanvas2.drawImage(img, 0, 0, 100, 100);
-offCanvas2.filter = 'blur(5px)';
-offCanvas2.drawImage(img, 100, 0, 100, 100);
-
-offCanvas2.filter = 'grayscale(50%)';
-offCanvas2.drawImage(img, 200, 0, 100, 100);
-
-offCanvas2.filter = 'hue-rotate(90deg)';
-offCanvas2.drawImage(img, 0, 100, 100, 100);
-
-offCanvas2.filter = 'invert(100%)';
-offCanvas2.drawImage(img, 100, 100, 100, 100);
+ ```
+
+
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ onShow(){
+ var ctx = this.$refs.canvasId.getContext('2d');
+ var offscreen = new OffscreenCanvas(360, 500);
+ var offCanvas2 = offscreen.getContext("2d");
+ var img = new Image();
+ img.src = 'common/images/flower.jpg';
+ offCanvas2.drawImage(img, 0, 0, 100, 100);
+ offCanvas2.filter = 'blur(5px)';
+ offCanvas2.drawImage(img, 100, 0, 100, 100);
+
+ offCanvas2.filter = 'grayscale(50%)';
+ offCanvas2.drawImage(img, 200, 0, 100, 100);
+
+ offCanvas2.filter = 'hue-rotate(90deg)';
+ offCanvas2.drawImage(img, 0, 100, 100, 100);
+
+ offCanvas2.filter = 'invert(100%)';
+ offCanvas2.drawImage(img, 100, 100, 100, 100);
+
+ offCanvas2.filter = 'drop-shadow(8px 8px 10px green)';
+ offCanvas2.drawImage(img, 200, 100, 100, 100);
+
+ offCanvas2.filter = 'brightness(0.4)';
+ offCanvas2.drawImage(img, 0, 200, 100, 100);
+
+ offCanvas2.filter = 'opacity(25%)';
+ offCanvas2.drawImage(img, 100, 200, 100, 100);
+
+ offCanvas2.filter = 'saturate(30%)';
+ offCanvas2.drawImage(img, 200, 200, 100, 100);
+
+ offCanvas2.filter = 'sepia(60%)';
+ offCanvas2.drawImage(img, 0, 300, 100, 100);
+
+ offCanvas2.filter = 'contrast(200%)';
+ offCanvas2.drawImage(img, 100, 300, 100, 100);
+ var bitmap = offscreen.transferToImageBitmap();
+ ctx.transferFromImageBitmap(bitmap);
+ }
+ }
+ ```
+
+ ![](figures/c3.png)
-offCanvas2.filter = 'drop-shadow(8px 8px 10px green)';
-offCanvas2.drawImage(img, 200, 100, 100, 100);
-offCanvas2.filter = 'brightness(0.4)';
-offCanvas2.drawImage(img, 0, 200, 100, 100);
-
-offCanvas2.filter = 'opacity(25%)';
-offCanvas2.drawImage(img, 100, 200, 100, 100);
+## Methods
-offCanvas2.filter = 'saturate(30%)';
-offCanvas2.drawImage(img, 200, 200, 100, 100);
+In addition to the attributes that are supported by **CanvasRenderingContext2D**, the following attributes are supported.
-offCanvas2.filter = 'sepia(60%)';
-offCanvas2.drawImage(img, 0, 300, 100, 100);
+### isPointInPath
+
+isPointInPath\(path?: Path2D, x: number, y: number\): boolean
+
+Checks whether a specified point is in the path area.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ path
+
+ Path2D
+
+ No
+
+ Path used for checking. If this parameter is not set, the current path is used.
+
+
+ x
+
+ number
+
+ Yes
+
+ X-coordinate of the point used for checking.
+
+
+ y
+
+ number
+
+ Yes
+
+ Y-coordinate of the point used for checking.
+
+
+
+
+
+- Return values
+
+
+ Type
+
+ Description
+
+
+
+ boolean
+
+ Whether a specified point is in the path area.
+
+
+
+
-offCanvas2.filter = 'contrast(200%)';
-offCanvas2.drawImage(img, 100, 300, 100, 100);
-var bitmap = offscreen.transferToImageBitmap();
-ctx.transferFromImageBitmap(bitmap);
-```
+- Example
-![](figures/en-us_image_0000001152773860.png)
+ ```
+
+
+ In path:{{textValue}}
+
+
+ ```
+
+ ```
+ // xxx.js
+ export default {
+ data: {
+ textValue: 0
+ },
+ onShow(){
+ var canvas = this.$refs.canvas.getContext('2d');
+ var offscreen = new OffscreenCanvas(500,500);
+ var offscreenCanvasCtx = offscreen.getContext("2d");
+
+ offscreenCanvasCtx.rect(10, 10, 100, 100);
+ offscreenCanvasCtx.fill();
+ this.textValue = offscreenCanvasCtx.isPointInPath(30, 70);
+
+ var bitmap = offscreen.transferToImageBitmap();
+ canvas.transferFromImageBitmap(bitmap);
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001224354967.png)
+
+
+### isPointInStroke
+
+isPointInStroke\(path?: Path2D, x: number, y: number\): boolean
+
+Checks whether a specified point is on the edge line of a path.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ path
+
+ Path2D
+
+ No
+
+ Path used for checking. If this parameter is not set, the current path is used.
+
+
+ x
+
+ number
+
+ Yes
+
+ X-coordinate of the point used for checking.
+
+
+ y
+
+ number
+
+ Yes
+
+ Y-coordinate of the point used for checking.
+
+
+
+
+
+- Return values
+
+
+ Type
+
+ Description
+
+
+
+ boolean
+
+ Whether a specified point is in the path area.
+
+
+
+
-## Methods
+- Example
-In addition to the attributes that are supported by **CanvasRenderingContext2D**, the following attributes are supported.
+ ```
+
+
+ In path:{{textValue}}
+
+
+ ```
+
+ ```
+ // xxx.js
+ export default {
+ data: {
+ textValue: 0
+ },
+ onShow(){
+ var canvas = this.$refs.canvas.getContext('2d');
+ var offscreen = new OffscreenCanvas(500,500);
+ var offscreenCanvasCtx = offscreen.getContext("2d");
+
+ offscreenCanvasCtx.rect(10, 10, 100, 100);
+ offscreenCanvasCtx.stroke();
+ this.textValue = offscreenCanvasCtx.isPointInStroke(50, 10);
+
+ var bitmap = offscreen.transferToImageBitmap();
+ canvas.transferFromImageBitmap(bitmap);
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001178875308.png)
+
+
+### resetTransform
+
+resetTransform\(\): void
-
- Name
-
- Parameter
-
- Description
-
-
-
- isPointInPath
-
-
- path?: Path2D, x: number, y: number
-
- Checks whether a specified point is in the path area.
- path : optional object, which specifies the path used for checking. If this parameter is not set, the current path is used.
- x : X-coordinate of the point used for checking.
- y : Y-coordinate of the point used for checking.
-
-
- isPointInStroke
-
- path?: Path2D, x: number, y: number
-
- Checks whether a specified point is on the edge line of a path.
- path : optional object, which specifies the path used for checking. If this parameter is not set, the current path is used.
- x : X-coordinate of the point used for checking.
- y : Y-coordinate of the point used for checking.
-
-
- resetTransform
-
- None
-
- Resets the current transformation to a unit matrix.
-
-
-
-
+- Example
-- isPointInPath example
-
-![](figures/en-us_image_0000001181449919.png)
-
-```
-
-
- In path:{{textValue}}
-
-
-```
-
-```
-// xxx.js
-export default {
- data: {
- textValue: 0
- },
- onShow(){
- var canvas = this.$refs.canvas.getContext('2d');
- var offscreen = new OffscreenCanvas(500,500);
- var offscreenCanvasCtx = offscreen.getContext("2d");
-
- offscreenCanvasCtx.rect(10, 10, 100, 100);
- offscreenCanvasCtx.fill();
- this.textValue = offscreenCanvasCtx.isPointInPath(30, 70);
-
- var bitmap = offscreen.transferToImageBitmap();
- canvas.transferFromImageBitmap(bitmap);
- }
-}
-```
-
-- isPointInStroke example
-
-![](figures/en-us_image_0000001181458721.png)
-
-```
-
-
- In path:{{textValue}}
-
-
-```
-
-```
-// xxx.js
-export default {
- data: {
- textValue: 0
- },
- onShow(){
- var canvas = this.$refs.canvas.getContext('2d');
- var offscreen = new OffscreenCanvas(500,500);
- var offscreenCanvasCtx = offscreen.getContext("2d");
-
- offscreenCanvasCtx.rect(10, 10, 100, 100);
- offscreenCanvasCtx.stroke();
- this.textValue = offscreenCanvasCtx.isPointInStroke(50, 10);
-
- var bitmap = offscreen.transferToImageBitmap();
- canvas.transferFromImageBitmap(bitmap);
- }
-}
-```
-
-- resetTransform example
-
-![](figures/en-us_image_0000001135171488.png)
-
-```
-var canvas = this.$refs.canvas.getContext('2d');
-var offscreen = new OffscreenCanvas(500,500);
-var offscreenCanvasCtx = offscreen.getContext("2d");
-
-offscreenCanvasCtx.transform(1, 0, 1.7, 1, 0, 0);
-offscreenCanvasCtx.fillStyle = 'gray';
-offscreenCanvasCtx.fillRect(40, 40, 50, 20);
-offscreenCanvasCtx.fillRect(40, 90, 50, 20);
-
-// Non-skewed rectangles
-offscreenCanvasCtx.resetTransform();
-offscreenCanvasCtx.fillStyle = 'red';
-offscreenCanvasCtx.fillRect(40, 40, 50, 20);
-offscreenCanvasCtx.fillRect(40, 90, 50, 20);
-
-var bitmap = offscreen.transferToImageBitmap();
-canvas.transferFromImageBitmap(bitmap);
-```
+ ```
+
+
+ In path:{{textValue}}
+
+
+ ```
+
+ ```
+ //xxx.js
+ export default {
+ data:{
+ textValue:0
+ },
+ onShow(){
+ var canvas = this.$refs.canvas.getContext('2d');
+ var offscreen = new OffscreenCanvas(500,500);
+ var offscreenCanvasCtx = offscreen.getContext("2d");
+
+ offscreenCanvasCtx.transform(1, 0, 1.7, 1, 0, 0);
+ offscreenCanvasCtx.fillStyle = 'gray';
+ offscreenCanvasCtx.fillRect(40, 40, 50, 20);
+ offscreenCanvasCtx.fillRect(40, 90, 50, 20);
+
+ // Non-skewed rectangles
+ offscreenCanvasCtx.resetTransform();
+ offscreenCanvasCtx.fillStyle = 'red';
+ offscreenCanvasCtx.fillRect(40, 40, 50, 20);
+ offscreenCanvasCtx.fillRect(40, 90, 50, 20);
+
+ var bitmap = offscreen.transferToImageBitmap();
+ canvas.transferFromImageBitmap(bitmap);
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001179035242.png)
diff --git a/en/application-dev/reference/arkui-js/js-web-development-like.md b/en/application-dev/reference/arkui-js/js-web-development-like.md
deleted file mode 100644
index 7e03ff8a6f32e8c64304b9ac13742e61410718a1..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/arkui-js/js-web-development-like.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# JavaScript-based Web-like Development Paradigm
-
-- **[Framework](js-framework.md)**
-
-- **[Components](js-components.md)**
-
-- **[Custom Components](js-components-custom.md)**
-
-- **[Appendix](js-appendix.md)**
-
-
diff --git a/en/application-dev/reference/arkui-ts/Readme-EN.md b/en/application-dev/reference/arkui-ts/Readme-EN.md
index 2cb89f59542b487fbb09140b152b4e54a4fe5dc9..634f77c8f6ced5b6a05c0e23caf97c342da2ef0f 100644
--- a/en/application-dev/reference/arkui-ts/Readme-EN.md
+++ b/en/application-dev/reference/arkui-ts/Readme-EN.md
@@ -1,82 +1,13 @@
# TypeScript-based Declarative Development Paradigm
-- [Framework Overview](ts-framework-framework.md)
- - [File Organization](ts-framework-file.md)
- - [Directory Structure](ts-framework-directory.md)
- - [Rules for Accessing Application Code Files](ts-framework-file-access-rules.md)
-
- - ["js" Tag](ts-framework-js-tag.md)
- - [Resource Access](ts-resource-access.md)
- - [Media Resource Types](ts-media-resource-type.md)
-
- - [Pixel Units](ts-pixel-units.md)
- - [Types](ts-types.md)
-
-- [Declarative Syntax](ts-declarative-syntax.md)
- - [Overview](ts-syntax-intro.md)
- - [General UI Description Specifications](ts-general-ui-description-specifications.md)
- - [Basic Concepts](ts-general-ui-concepts.md)
- - [Declarative UI Description Specifications](ts-declarative-ui-description-specifications.md)
- - [Parameterless Configuration](ts-parameterless-configuration.md)
- - [Configuration with Mandatory Parameters](ts-configuration-with-mandatory-parameters.md)
- - [Attribution Configuration](ts-attribution-configuration.md)
- - [Event Configuration](ts-event-configuration.md)
- - [Child Component Configuration](ts-child-component-configuration.md)
-
- - [Component-based](ts-component-based.md)
- - [@Component](ts-component-based-component.md)
- - [@Entry](ts-component-based-entry.md)
- - [@Preview](ts-component-based-preview.md)
- - [@Builder](ts-component-based-builder.md)
- - [@Extend](ts-component-based-extend.md)
- - [@CustomDialog](ts-component-based-customdialog.md)
-
- - [UI State Management](ts-ui-state-management.md)
- - [Basic Concepts](ts-ui-state-mgmt-concepts.md)
- - [Managing Component States](ts-managing-component-states.md)
- - [@State](ts-component-states-state.md)
- - [@Prop](ts-component-states-prop.md)
- - [@Link](ts-component-states-link.md)
-
- - [Managing Application States](ts-managing-application-states.md)
- - [APIs](ts-managing-application-states-apis.md)
- - [AppStorage](ts-application-states-appstorage.md)
- - [PersistentStorage](ts-application-states-apis-persistentstorage.md)
- - [Environment](ts-application-states-apis-environment.md)
-
- - [Synchronization Between AppStorage and Components](ts-application-states-storagelink-storageprop.md)
-
- - [Managing Other States](ts-managing-other-states.md)
- - [@observed and @objectLink](ts-other-states-observed-objectlink.md)
- - [@Consume and @Provide](ts-other-states-consume-provide.md)
- - [@Watch](ts-other-states-watch.md)
-
- - [Rendering Control Syntax](ts-rending-control-syntax.md)
- - [if/else](ts-rending-control-syntax-if-else.md)
- - [ForEach](ts-rending-control-syntax-foreach.md)
- - [LazyForEach](ts-rending-control-syntax-lazyforeach.md)
-
- - [A Deep Dive into @Component](ts-a-deep-dive-into-component.md)
- - [build Function](ts-function-build.md)
- - [Custom Component Initialization](ts-custom-component-initialization.md)
- - [Custom Component Lifecycle Callbacks](ts-custom-component-lifecycle-callbacks.md)
- - [Example: Component Creation and Re-Initialization](ts-component-creation-re-initialization.md)
-
- - [Syntactic Sugar](ts-syntactic-sugar.md)
- - [@Decorator](ts-syntactic-sugar-decorator.md)
- - [Chaining](ts-syntactic-sugar-chaining.md)
- - [struct](ts-syntactic-sugar-struct.md)
- - [Instantiating a struct Without the new Keyword](ts-instantiating-a-struct-without-new-keyword.md)
- - [Using a Separate Line for New Component](ts-using-a-separate-line-for-new-component.md)
- - [Restrictions on Using the TS Language for Generators](ts-restrictions-for-generators.md)
-
- [Components](ts-components.md)
- [Universal Components](ts-universal-components.md)
- [Universal Events](ts-universal-events.md)
- [Click Event](ts-universal-events-click.md)
- - [Touch Event](ts-universal-events-touch.md)
+ - [Touch](ts-universal-events-touch.md)
- [Show/Hide Event](ts-universal-events-show-hide.md)
- [Key Event](ts-universal-events-key.md)
+ - [Component Area Change Event](ts-universal-events-component-area-change.md)
- [Universal Attributes](ts-universal-attributes.md)
- [Size](ts-universal-attributes-size.md)
@@ -98,6 +29,8 @@
- [Gradient Color](ts-universal-attributes-gradient-color.md)
- [Popup Control](ts-universal-attributes-popup.md)
- [Menu Control](ts-universal-attributes-menu.md)
+ - [Click Control](ts-universal-attributes-touchable.md)
+ - [Touch Target](ts-universal-attributes-response-region.md)
- [Gesture Processing](ts-gesture-processing.md)
- [Gesture Binding Methods](ts-gesture-settings.md)
@@ -107,6 +40,7 @@
- [PanGesture](ts-basic-gestures-pangesture.md)
- [PinchGesture](ts-basic-gestures-pinchgesture.md)
- [RotationGesture](ts-basic-gestures-rotationgesture.md)
+ - [SwipeGesture](ts-basic-gestures-swipegesture.md)
- [Combined Gestures](ts-combined-gestures.md)
@@ -115,14 +49,19 @@
- [Button](ts-basic-components-button.md)
- [DataPanel](ts-basic-components-datapanel.md)
- [Divider](ts-basic-components-divider.md)
+ - [Gauge](ts-basic-components-gauge.md)
- [Image](ts-basic-components-image.md)
- [ImageAnimator](ts-basic-components-imageanimator.md)
+ - [Marquee](ts-basic-components-marquee.md)
- [Progress](ts-basic-components-progress.md)
- [QRCode](ts-basic-components-qrcode.md)
- [Rating](ts-basic-components-rating.md)
- [Span](ts-basic-components-span.md)
- [Slider](ts-basic-components-slider.md)
- [Text](ts-basic-components-text.md)
+ - [TextArea](ts-basic-components-textarea.md)
+ - [TextInput](ts-basic-components-textinput.md)
+ - [Toggle](ts-basic-components-toggle.md)
- [Container Components](ts-components-container.md)
- [AlphabetIndexer](ts-container-alphabet-indexer.md)
@@ -137,14 +76,18 @@
- [List](ts-container-list.md)
- [ListItem](ts-container-listitem.md)
- [Navigator](ts-container-navigator.md)
+ - [Navigation](ts-container-navigation.md)
- [Panel](ts-container-panel.md)
- [Row](ts-container-row.md)
- [RowSplit](ts-container-rowsplit.md)
- [Scroll](ts-container-scroll.md)
+ - [ScrollBar](ts-container-scrollbar.md)
- [Stack](ts-container-stack.md)
- [Swiper](ts-container-swiper.md)
- [Tabs](ts-container-tabs.md)
- [TabContent](ts-container-tabcontent.md)
+ - [Stepper](ts-container-stepper.md)
+ - [StepperItem](ts-container-stepperitem.md)
- [Drawing Components](ts-drawing-components.md)
- [Circle](ts-drawing-components-circle.md)
@@ -156,8 +99,18 @@
- [Rect](ts-drawing-components-rect.md)
- [Shape](ts-drawing-components-shape.md)
+ - [Canvas Components](ts-components-canvas.md)
+ - [Canvas](ts-components-canvas-canvas.md)
+ - [CanvasRenderingContext2D](ts-canvasrenderingcontext2d.md)
+ - [OffscreenCanvasRenderingConxt2D](ts-offscreencanvasrenderingcontext2d.md)
+ - [Lottie](ts-components-canvas-lottie.md)
+ - [Path2D](ts-components-canvas-path2d.md)
+ - [CanvasGradient](ts-components-canvas-canvasgradient.md)
+ - [ImageBitmap](ts-components-canvas-imagebitmap.md)
+ - [ImageData](ts-components-canvas-imagedata.md)
+
- [Animation](ts-animation.md)
- - [AnimatorProperty](ts-animatorproperty.md)
+ - [Attribute Animation](ts-animatorproperty.md)
- [Explicit Animation](ts-explicit-animation.md)
- [Transition Animation](ts-transition-animation.md)
- [Page Transition](ts-page-transition-animation.md)
@@ -173,6 +126,7 @@
- [Custom Dialog box](ts-methods-custom-dialog-box.md)
- [Image Cache](ts-methods-image-cache.md)
- [Media Query](ts-methods-media-query.md)
+ - [List Selection Dialog Box](ts-methods-custom-actionsheet.md)
- [Appendix](ts-appendix.md)
- [Built-in Enums](ts-appendix-enums.md)
diff --git a/en/application-dev/reference/arkui-ts/figures/1-64.png b/en/application-dev/reference/arkui-ts/figures/1.png
similarity index 100%
rename from en/application-dev/reference/arkui-ts/figures/1-64.png
rename to en/application-dev/reference/arkui-ts/figures/1.png
diff --git a/en/application-dev/reference/arkui-ts/figures/1111-59.png b/en/application-dev/reference/arkui-ts/figures/1111.png
similarity index 100%
rename from en/application-dev/reference/arkui-ts/figures/1111-59.png
rename to en/application-dev/reference/arkui-ts/figures/1111.png
diff --git a/en/application-dev/reference/arkui-ts/figures/11111-5.png b/en/application-dev/reference/arkui-ts/figures/11111-5.png
new file mode 100644
index 0000000000000000000000000000000000000000..5da42e3e14d601745274cb62d914c6600620bb25
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/11111-5.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/11111.png b/en/application-dev/reference/arkui-ts/figures/11111.png
new file mode 100644
index 0000000000000000000000000000000000000000..5da42e3e14d601745274cb62d914c6600620bb25
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/11111.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/2-01.png b/en/application-dev/reference/arkui-ts/figures/2-01.png
new file mode 100644
index 0000000000000000000000000000000000000000..e766d36181c3d1fbd96bb0acab1b3eb670e14cd4
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/2-01.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/5-65.gif b/en/application-dev/reference/arkui-ts/figures/5.gif
similarity index 100%
rename from en/application-dev/reference/arkui-ts/figures/5-65.gif
rename to en/application-dev/reference/arkui-ts/figures/5.gif
diff --git a/en/application-dev/reference/arkui-ts/figures/66666.gif b/en/application-dev/reference/arkui-ts/figures/66666.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b40f786a2f583af59e9f63d35ab1d503f51525da
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/66666.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/blank1.gif b/en/application-dev/reference/arkui-ts/figures/blank1.gif
new file mode 100644
index 0000000000000000000000000000000000000000..2547cd4af312ee9a2cfc6c3c61b630fdcd7426f9
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/blank1.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/blank2.gif b/en/application-dev/reference/arkui-ts/figures/blank2.gif
new file mode 100644
index 0000000000000000000000000000000000000000..fe04e9611135b8d8cd4f9ace0acf1d1a5797bf6c
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/blank2.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/blank_h.gif b/en/application-dev/reference/arkui-ts/figures/blank_h.gif
deleted file mode 100644
index 6f3a05c4fa0ac29097cc25d6021fa33f069f6175..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/blank_h.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/blank_v.gif b/en/application-dev/reference/arkui-ts/figures/blank_v.gif
deleted file mode 100644
index 04e09206185deb61233c3bf51a302cc0ccc9c080..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/blank_v.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/click.gif b/en/application-dev/reference/arkui-ts/figures/click.gif
deleted file mode 100644
index 20a61f7c3daa0e4225a7421803948c073fb9fe31..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/click.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/datapanel.jpg b/en/application-dev/reference/arkui-ts/figures/datapanel.jpg
new file mode 100644
index 0000000000000000000000000000000000000000..b12c5fb6563c7ee9d8dfa7e6af1cfe1dcfa1361c
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/datapanel.jpg differ
diff --git a/en/application-dev/reference/arkui-ts/figures/datapanel.png b/en/application-dev/reference/arkui-ts/figures/datapanel.png
deleted file mode 100644
index 6b8ac87fce6a2b4aebc98304db6ed2fd7d14cb82..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/datapanel.png and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/divider.png b/en/application-dev/reference/arkui-ts/figures/divider.png
deleted file mode 100644
index f2deeb8445fe0f3b66d2b0facbf9e0f0ed9911ca..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/divider.png and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/duande.gif b/en/application-dev/reference/arkui-ts/figures/duande.gif
new file mode 100644
index 0000000000000000000000000000000000000000..7ed4e908925042a11312dd27aa1c28e8c91d8d8c
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/duande.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/ellipse-63.png b/en/application-dev/reference/arkui-ts/figures/ellipse.png
similarity index 100%
rename from en/application-dev/reference/arkui-ts/figures/ellipse-63.png
rename to en/application-dev/reference/arkui-ts/figures/ellipse.png
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001182200571.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001182200571.png
deleted file mode 100644
index c3d760c6d3f6c1e377ff2e42c0b3fb9e547ac140..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001182200571.png and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595194.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595194.png
new file mode 100644
index 0000000000000000000000000000000000000000..348499bc3787a833ab3da5f87500b11c9c93773e
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595194.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595214.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595214.png
new file mode 100644
index 0000000000000000000000000000000000000000..e544a2958b969018ff6bfe8b44bb8758c2aea61a
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595214.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595216.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595216.png
new file mode 100644
index 0000000000000000000000000000000000000000..f410f22c1dd0ba7e1c9718eb3995de5f5033c0a6
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595216.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595220.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595220.png
new file mode 100644
index 0000000000000000000000000000000000000000..2eed5759714b99dc039faab67acdfe6d67bfc6ac
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595220.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595224.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595224.png
new file mode 100644
index 0000000000000000000000000000000000000000..72a515c8b425037a4307ef1b16def3e528aab4a0
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595224.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595226.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595226.png
new file mode 100644
index 0000000000000000000000000000000000000000..92a309337be0e2f4c49d0484dab0ffd19584b534
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595226.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595228.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595228.png
new file mode 100644
index 0000000000000000000000000000000000000000..1f4208ebcf5ffeeda0d1f5c452327c8fd8dcf7ac
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595228.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595230.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595230.png
new file mode 100644
index 0000000000000000000000000000000000000000..b4fd4aff2fb6b7a32fcb8af41a84fbf57c26d035
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595230.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595232.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595232.png
new file mode 100644
index 0000000000000000000000000000000000000000..160278c82fcdf310c796609d5ee29a2a4869af9e
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595232.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595234.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595234.png
new file mode 100644
index 0000000000000000000000000000000000000000..ec9ddc678b5a74f1e5ae78ba6a9c35618f31a589
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595234.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595238.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595238.png
new file mode 100644
index 0000000000000000000000000000000000000000..d3db21e0e3da6d8663f59b2ddabd9e50d6eb1e6a
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192595238.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755172.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755172.png
new file mode 100644
index 0000000000000000000000000000000000000000..5869f7cdc9a81adc7f03d07ab121c6b8433637d9
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755172.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755174.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755174.png
new file mode 100644
index 0000000000000000000000000000000000000000..adb4986f7f26047e65e552c570e3f9e62a2037ac
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755174.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755178.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755178.png
new file mode 100644
index 0000000000000000000000000000000000000000..801bf97495213f41c2b196b2f170af85b156dd5b
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755178.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755180.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755180.png
new file mode 100644
index 0000000000000000000000000000000000000000..4fb651372a67eca9de3848baa6b66cac0ee9f173
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755180.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755182.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755182.png
new file mode 100644
index 0000000000000000000000000000000000000000..0d9cf4d6e06b96da9b93608e7a050af71eaa5032
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755182.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755188.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755188.png
new file mode 100644
index 0000000000000000000000000000000000000000..cb250dfc130cc329ae9dc74ddb861e8753d419c3
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755188.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755194.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755194.png
new file mode 100644
index 0000000000000000000000000000000000000000..4608132f8e4292a3fe0174a65a9a3f2fc428c0e7
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192755194.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915130.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915130.png
new file mode 100644
index 0000000000000000000000000000000000000000..1ba89fa119f9a64c74b9353c20ec3d741aaad9be
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915130.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915154.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915154.png
new file mode 100644
index 0000000000000000000000000000000000000000..f36078d6d832fa757378b72fa0739f66fe781c64
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915154.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915158.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915158.png
new file mode 100644
index 0000000000000000000000000000000000000000..d8bdc2d4a59d0b3c5de0f8c020d30ffc5b2ead7a
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915158.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915162.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915162.png
new file mode 100644
index 0000000000000000000000000000000000000000..1ba89fa119f9a64c74b9353c20ec3d741aaad9be
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915162.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915178.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915178.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b1808e80a0e4d055d54b886ecca3ddc8efa64b9a
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915178.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915180.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915180.png
new file mode 100644
index 0000000000000000000000000000000000000000..7dafd299b8e48ead7d6f783e5a370e31257e341c
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915180.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915184.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915184.png
new file mode 100644
index 0000000000000000000000000000000000000000..ee1d5493dd38de810cbfe5e41e54d507b839e9c9
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001192915184.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075122.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075122.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b26dc8bf409987fa624f6dc0cec1c56043e7b37a
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075122.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075134.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075134.png
new file mode 100644
index 0000000000000000000000000000000000000000..241fe8546ea2acfdb7baf2c5e66a8af2f0d7b593
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075134.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075154.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075154.png
new file mode 100644
index 0000000000000000000000000000000000000000..8c06945a1790bb0a741b330fe0a9170dd2a3a92d
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075154.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075164.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075164.png
new file mode 100644
index 0000000000000000000000000000000000000000..45be809bdb14e8badfaac2dc8e2486864d29f763
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075164.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075166.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075166.png
new file mode 100644
index 0000000000000000000000000000000000000000..fb7fc25c17990998ba263a8525e6a110794c0d87
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075166.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075168.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075168.png
new file mode 100644
index 0000000000000000000000000000000000000000..5eecca641660f12e3ad2ba7b97b97eca253a4acf
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075168.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075170.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075170.png
new file mode 100644
index 0000000000000000000000000000000000000000..241fe8546ea2acfdb7baf2c5e66a8af2f0d7b593
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075170.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075172.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075172.png
new file mode 100644
index 0000000000000000000000000000000000000000..5d649492978121a484c2a7a55d4548384c919149
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075172.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075178.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075178.png
new file mode 100644
index 0000000000000000000000000000000000000000..4f115a17e671fa21da2d44cd82bf7b0f3c70c0a6
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075178.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075180.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075180.png
new file mode 100644
index 0000000000000000000000000000000000000000..7cbe07731306eff949ff7ced4dd7eb4a374c8310
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193075180.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193321136.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193321136.png
new file mode 100644
index 0000000000000000000000000000000000000000..72a515c8b425037a4307ef1b16def3e528aab4a0
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193321136.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193321138.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193321138.png
new file mode 100644
index 0000000000000000000000000000000000000000..fb7fc25c17990998ba263a8525e6a110794c0d87
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193321138.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193322850.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193322850.png
new file mode 100644
index 0000000000000000000000000000000000000000..657eee10e270eb448fc7f7f4b24b18134a42d5dc
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193322850.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193322872.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193322872.png
new file mode 100644
index 0000000000000000000000000000000000000000..7cbe07731306eff949ff7ced4dd7eb4a374c8310
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193322872.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193322910.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193322910.png
new file mode 100644
index 0000000000000000000000000000000000000000..e764c43599592d821c403aac0d3fa40d9edd22e5
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193322910.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193436448.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193436448.png
new file mode 100644
index 0000000000000000000000000000000000000000..2eed5759714b99dc039faab67acdfe6d67bfc6ac
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193436448.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193481094.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193481094.png
new file mode 100644
index 0000000000000000000000000000000000000000..1f4208ebcf5ffeeda0d1f5c452327c8fd8dcf7ac
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193481094.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193481096.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193481096.png
new file mode 100644
index 0000000000000000000000000000000000000000..138e011909c2d4738f3cd9671a79ea0c37cb5b87
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193481096.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193481098.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193481098.png
new file mode 100644
index 0000000000000000000000000000000000000000..defc3c9eb037c06b894ee2e30563facb8c8375ab
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193481098.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193482814.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193482814.png
new file mode 100644
index 0000000000000000000000000000000000000000..45be809bdb14e8badfaac2dc8e2486864d29f763
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193482814.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193482866.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193482866.png
new file mode 100644
index 0000000000000000000000000000000000000000..5eecca641660f12e3ad2ba7b97b97eca253a4acf
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193482866.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193641084.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193641084.png
new file mode 100644
index 0000000000000000000000000000000000000000..563ce2878d24a7fa46044f201433d759c3fa9001
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193641084.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193641086.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193641086.png
new file mode 100644
index 0000000000000000000000000000000000000000..801bf97495213f41c2b196b2f170af85b156dd5b
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193641086.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193642802.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193642802.png
new file mode 100644
index 0000000000000000000000000000000000000000..160278c82fcdf310c796609d5ee29a2a4869af9e
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193642802.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193642848.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193642848.png
new file mode 100644
index 0000000000000000000000000000000000000000..83b7a51accdda21d21a39e5e9d917d75811cb496
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193642848.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193737314.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193737314.png
new file mode 100644
index 0000000000000000000000000000000000000000..e3b4b42aecaef72ed4a08b3566a895b3f9b12343
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193737314.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193756416.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193756416.png
new file mode 100644
index 0000000000000000000000000000000000000000..b0b8bdc7fc7cd417340bbcda6845fd7de0098930
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193756416.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193801070.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193801070.png
new file mode 100644
index 0000000000000000000000000000000000000000..92a309337be0e2f4c49d0484dab0ffd19584b534
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193801070.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193801072.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193801072.png
new file mode 100644
index 0000000000000000000000000000000000000000..b4fd4aff2fb6b7a32fcb8af41a84fbf57c26d035
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193801072.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193802788.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193802788.png
new file mode 100644
index 0000000000000000000000000000000000000000..c1803b711d45a86552a2be4099424206a1561534
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193802788.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193802836.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193802836.png
new file mode 100644
index 0000000000000000000000000000000000000000..ad8582f58ed05f9ac3b8962f82d8565d1f580f6c
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001193802836.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194605518.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194605518.png
new file mode 100644
index 0000000000000000000000000000000000000000..085d31e9bf7c5740ac3c46d04c4098e64eb3a544
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194605518.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194911566.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194911566.png
new file mode 100644
index 0000000000000000000000000000000000000000..8c8194c14b5ca1ea743782db95027035370ead7e
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194911566.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194942468.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194942468.gif
new file mode 100644
index 0000000000000000000000000000000000000000..ecbaeb8cc1a3ec9e1ecfd253b605be50836b1f46
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001194942468.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001196780640.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001196780640.png
new file mode 100644
index 0000000000000000000000000000000000000000..857e773f72d0cd7cd9ae13f50aa843a11aae4f97
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001196780640.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001201475612.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001201475612.gif
new file mode 100644
index 0000000000000000000000000000000000000000..502888c25bb21b3803858f9c436cca23d9dc29d0
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001201475612.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355087.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355087.gif
new file mode 100644
index 0000000000000000000000000000000000000000..38502c83c52aa9229da69d638e4b9b1f5a35009b
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355087.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355121.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355121.png
new file mode 100644
index 0000000000000000000000000000000000000000..e764c43599592d821c403aac0d3fa40d9edd22e5
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355121.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355131.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355131.png
new file mode 100644
index 0000000000000000000000000000000000000000..138e011909c2d4738f3cd9671a79ea0c37cb5b87
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355131.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355133.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355133.png
new file mode 100644
index 0000000000000000000000000000000000000000..088d5a479cc188332bb7295b31aea277897faca8
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355133.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355135.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355135.png
new file mode 100644
index 0000000000000000000000000000000000000000..10059591af349daced4bf7abeb009209a3e90f1d
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355135.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355137.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355137.png
new file mode 100644
index 0000000000000000000000000000000000000000..83b7a51accdda21d21a39e5e9d917d75811cb496
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237355137.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475107.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475107.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b3966d0abb39044241ee174a126fcf919f402d98
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475107.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475113.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475113.png
new file mode 100644
index 0000000000000000000000000000000000000000..84d835e7feeac31e42c1a53670ef6c999ea4bfe2
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475113.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475123.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475123.png
new file mode 100644
index 0000000000000000000000000000000000000000..e3b4b42aecaef72ed4a08b3566a895b3f9b12343
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475123.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475133.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475133.png
new file mode 100644
index 0000000000000000000000000000000000000000..f0e245a5c576e92810baacaa09af99f108a010a9
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475133.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475137.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475137.png
new file mode 100644
index 0000000000000000000000000000000000000000..defc3c9eb037c06b894ee2e30563facb8c8375ab
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475137.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475139.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475139.png
new file mode 100644
index 0000000000000000000000000000000000000000..9cb1361bd9aded6d58d51ae771558989977a0608
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237475139.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555149.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555149.png
new file mode 100644
index 0000000000000000000000000000000000000000..1ba89fa119f9a64c74b9353c20ec3d741aaad9be
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555149.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555151.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555151.png
new file mode 100644
index 0000000000000000000000000000000000000000..1330e2e2a6395703f9c3747252c1e0a69ae6f4f0
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555151.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555155.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555155.png
new file mode 100644
index 0000000000000000000000000000000000000000..071919ed3a638630f33a337f920ae2e60c9c21bc
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555155.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555163.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555163.png
new file mode 100644
index 0000000000000000000000000000000000000000..26fb5384338291f3eb372abd526f0727ce759bdc
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555163.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555165.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555165.png
new file mode 100644
index 0000000000000000000000000000000000000000..50726d3e461d7a5dbfec674899fee603aaf41bee
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555165.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555167.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555167.png
new file mode 100644
index 0000000000000000000000000000000000000000..af02181de0d07d5311b09c8d05c2a018e6e5b4cf
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555167.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555173.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555173.png
new file mode 100644
index 0000000000000000000000000000000000000000..657eee10e270eb448fc7f7f4b24b18134a42d5dc
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555173.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555179.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555179.png
new file mode 100644
index 0000000000000000000000000000000000000000..cb250dfc130cc329ae9dc74ddb861e8753d419c3
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555179.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555181.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555181.png
new file mode 100644
index 0000000000000000000000000000000000000000..b2728fd1b4e050edddf499398b44a7e3aa634109
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237555181.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715141.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715141.png
new file mode 100644
index 0000000000000000000000000000000000000000..c1803b711d45a86552a2be4099424206a1561534
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715141.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715149.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715149.png
new file mode 100644
index 0000000000000000000000000000000000000000..b0b8bdc7fc7cd417340bbcda6845fd7de0098930
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715149.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715151.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715151.png
new file mode 100644
index 0000000000000000000000000000000000000000..1f4208ebcf5ffeeda0d1f5c452327c8fd8dcf7ac
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715151.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715153.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715153.png
new file mode 100644
index 0000000000000000000000000000000000000000..22e84d1b8951b163748a079b6d1d302148d3b6bb
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715153.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715155.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715155.png
new file mode 100644
index 0000000000000000000000000000000000000000..945862898489d8e008e94abbcd691aa307b18d06
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715155.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715159.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715159.png
new file mode 100644
index 0000000000000000000000000000000000000000..3e7218eb57566d86457a9fbd4a8ed0f0dd490c3f
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715159.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715165.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715165.png
new file mode 100644
index 0000000000000000000000000000000000000000..f5cd637e5bf9db13e3334ca00413e3a91412c813
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001237715165.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238281067.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238281067.png
new file mode 100644
index 0000000000000000000000000000000000000000..22e84d1b8951b163748a079b6d1d302148d3b6bb
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238281067.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238281069.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238281069.png
new file mode 100644
index 0000000000000000000000000000000000000000..088d5a479cc188332bb7295b31aea277897faca8
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238281069.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238282783.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238282783.png
new file mode 100644
index 0000000000000000000000000000000000000000..10059591af349daced4bf7abeb009209a3e90f1d
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238282783.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238282827.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238282827.png
new file mode 100644
index 0000000000000000000000000000000000000000..b2728fd1b4e050edddf499398b44a7e3aa634109
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238282827.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238401029.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238401029.png
new file mode 100644
index 0000000000000000000000000000000000000000..d0e446b213816e4db8d67a9898da1afa7b8226ad
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238401029.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238401031.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238401031.png
new file mode 100644
index 0000000000000000000000000000000000000000..d3db21e0e3da6d8663f59b2ddabd9e50d6eb1e6a
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238401031.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238402745.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238402745.png
new file mode 100644
index 0000000000000000000000000000000000000000..4608132f8e4292a3fe0174a65a9a3f2fc428c0e7
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238402745.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238402777.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238402777.png
new file mode 100644
index 0000000000000000000000000000000000000000..f5cd637e5bf9db13e3334ca00413e3a91412c813
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238402777.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238457271.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238457271.png
new file mode 100644
index 0000000000000000000000000000000000000000..4fb651372a67eca9de3848baa6b66cac0ee9f173
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238457271.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238476361.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238476361.png
new file mode 100644
index 0000000000000000000000000000000000000000..5d649492978121a484c2a7a55d4548384c919149
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238476361.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238521019.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238521019.png
new file mode 100644
index 0000000000000000000000000000000000000000..af02181de0d07d5311b09c8d05c2a018e6e5b4cf
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238521019.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238521021.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238521021.png
new file mode 100644
index 0000000000000000000000000000000000000000..3e7218eb57566d86457a9fbd4a8ed0f0dd490c3f
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238521021.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238522733.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238522733.png
new file mode 100644
index 0000000000000000000000000000000000000000..4f115a17e671fa21da2d44cd82bf7b0f3c70c0a6
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238522733.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238522783.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238522783.png
new file mode 100644
index 0000000000000000000000000000000000000000..bc093379e122dcac29c4c8d04560d26bfc23d472
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238522783.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238537297.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238537297.png
new file mode 100644
index 0000000000000000000000000000000000000000..50726d3e461d7a5dbfec674899fee603aaf41bee
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238537297.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238556395.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238556395.png
new file mode 100644
index 0000000000000000000000000000000000000000..294b32cf04462b04243afb828199be9b95e6dd17
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238556395.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238601051.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238601051.png
new file mode 100644
index 0000000000000000000000000000000000000000..1f4208ebcf5ffeeda0d1f5c452327c8fd8dcf7ac
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238601051.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238601053.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238601053.png
new file mode 100644
index 0000000000000000000000000000000000000000..945862898489d8e008e94abbcd691aa307b18d06
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238601053.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238602771.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238602771.png
new file mode 100644
index 0000000000000000000000000000000000000000..ec9ddc678b5a74f1e5ae78ba6a9c35618f31a589
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238602771.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238602821.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238602821.png
new file mode 100644
index 0000000000000000000000000000000000000000..9cb1361bd9aded6d58d51ae771558989977a0608
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001238602821.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001239788885.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001239788885.gif
new file mode 100644
index 0000000000000000000000000000000000000000..6b44b6a2adc2528e13e95bc10d2a67874226a63b
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001239788885.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001239925031.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001239925031.gif
new file mode 100644
index 0000000000000000000000000000000000000000..05ad0a8aa0ae63ae9193aa1c9b3f943f060220da
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001239925031.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/f.gif b/en/application-dev/reference/arkui-ts/figures/f.gif
new file mode 100644
index 0000000000000000000000000000000000000000..070ae9d042d5211b2ccc6c187ec0f87a90d2c963
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/f.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/flex04-61.gif b/en/application-dev/reference/arkui-ts/figures/flex04-2.gif
similarity index 100%
rename from en/application-dev/reference/arkui-ts/figures/flex04-61.gif
rename to en/application-dev/reference/arkui-ts/figures/flex04-2.gif
diff --git a/en/application-dev/reference/arkui-ts/figures/gauge.png b/en/application-dev/reference/arkui-ts/figures/gauge.png
new file mode 100644
index 0000000000000000000000000000000000000000..2eb96b00f11e597fcc3e3d5ef32701e0a4ef5f5b
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/gauge.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/gesturesetting.gif b/en/application-dev/reference/arkui-ts/figures/gesturesetting.gif
deleted file mode 100644
index d8e941ae58c68666c04183756b9549cef9d9d3b0..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/gesturesetting.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/gif-0.gif b/en/application-dev/reference/arkui-ts/figures/gif-0.gif
new file mode 100644
index 0000000000000000000000000000000000000000..23a03cf07feddcb9866e7ab141c212ebf01bf8b2
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/gif-0.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/gif-1.gif b/en/application-dev/reference/arkui-ts/figures/gif-1.gif
new file mode 100644
index 0000000000000000000000000000000000000000..52fed39eeae057043dbd00abce9ff29d2c35a56a
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/gif-1.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/gif-4.gif b/en/application-dev/reference/arkui-ts/figures/gif-4.gif
new file mode 100644
index 0000000000000000000000000000000000000000..5bcc79b53b227b6bd0484045d20743d9686c8e08
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/gif-4.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/gif.gif b/en/application-dev/reference/arkui-ts/figures/gif.gif
new file mode 100644
index 0000000000000000000000000000000000000000..8eceb3bf5313485a1fedda5768e70cdb5febc464
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/gif.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/gif1.gif b/en/application-dev/reference/arkui-ts/figures/gif1.gif
new file mode 100644
index 0000000000000000000000000000000000000000..e97b2a2406059ce3af77ade27bb634845d807726
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/gif1.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/gif2.gif b/en/application-dev/reference/arkui-ts/figures/gif2.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b0a6fc0df420fa15f8a0e476da5fa8592bbc751b
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/gif2.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/gif4.gif b/en/application-dev/reference/arkui-ts/figures/gif4.gif
new file mode 100644
index 0000000000000000000000000000000000000000..c7532ed87726ac7591901514a7396b617daa10f0
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/gif4.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/grid-62.gif b/en/application-dev/reference/arkui-ts/figures/grid-3.gif
similarity index 100%
rename from en/application-dev/reference/arkui-ts/figures/grid-62.gif
rename to en/application-dev/reference/arkui-ts/figures/grid-3.gif
diff --git a/en/application-dev/reference/arkui-ts/figures/image1.gif b/en/application-dev/reference/arkui-ts/figures/image1.gif
deleted file mode 100644
index 6bc2dfa331eb3b39fc32aa6c1fa131684dff3220..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/image1.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/image2.gif b/en/application-dev/reference/arkui-ts/figures/image2.gif
deleted file mode 100644
index e4ac98cf8925e5ae93206fb663bef01e4d929169..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/image2.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/image3.gif b/en/application-dev/reference/arkui-ts/figures/image3.gif
deleted file mode 100644
index 209112f1e4c14478df3f44390732d4b2c70755f4..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/image3.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/lottie-ark-2-0-canvas-ui-animate.gif b/en/application-dev/reference/arkui-ts/figures/lottie-ark-2-0-canvas-ui-animate.gif
new file mode 100644
index 0000000000000000000000000000000000000000..e22d25b7aa139409766723e4ed0fd6172b85b6cf
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/lottie-ark-2-0-canvas-ui-animate.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/overlay.gif b/en/application-dev/reference/arkui-ts/figures/overlay.gif
deleted file mode 100644
index 4cce6cb6a529cffef01d5b7d1f6ce5f02d63210e..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/overlay.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/popup.gif b/en/application-dev/reference/arkui-ts/figures/popup.gif
index 3bbb23f623eb1163af382d30bc32c1c4cbe524dd..7631bb0d995839d59a9d3876f91fd7e688c35758 100644
Binary files a/en/application-dev/reference/arkui-ts/figures/popup.gif and b/en/application-dev/reference/arkui-ts/figures/popup.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/progress-60.png b/en/application-dev/reference/arkui-ts/figures/progress.png
similarity index 100%
rename from en/application-dev/reference/arkui-ts/figures/progress-60.png
rename to en/application-dev/reference/arkui-ts/figures/progress.png
diff --git a/en/application-dev/reference/arkui-ts/figures/shape.gif b/en/application-dev/reference/arkui-ts/figures/shape.gif
deleted file mode 100644
index 467de1302c615f93709c266f3d5a47ecb941fc53..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/shape.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/sider.gif b/en/application-dev/reference/arkui-ts/figures/sider.gif
deleted file mode 100644
index 733585b5ca3cbb4fdf690e596b622f56393700d0..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/sider.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/slider.gif b/en/application-dev/reference/arkui-ts/figures/slider.gif
new file mode 100644
index 0000000000000000000000000000000000000000..b1724791e4acb31d193a0dce267e42c99288c6bd
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/slider.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/swiper.gif b/en/application-dev/reference/arkui-ts/figures/swiper.gif
index bf8d1335752f51258920d0cfc1b65190e2f53011..5db399f79a02f496aea43ff72e55e29a0bb05a9a 100644
Binary files a/en/application-dev/reference/arkui-ts/figures/swiper.gif and b/en/application-dev/reference/arkui-ts/figures/swiper.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/textarea1.gif b/en/application-dev/reference/arkui-ts/figures/textarea1.gif
new file mode 100644
index 0000000000000000000000000000000000000000..5c888d43eeb0d0d3ab08e0c2922f136ed0b3d142
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/textarea1.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/textinput1.gif b/en/application-dev/reference/arkui-ts/figures/textinput1.gif
new file mode 100644
index 0000000000000000000000000000000000000000..9fa5c075ecc4f157f1e66316f4b56f28ffa2007d
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/textinput1.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/toggle.gif b/en/application-dev/reference/arkui-ts/figures/toggle.gif
new file mode 100644
index 0000000000000000000000000000000000000000..f6b7ae5ac2bf443574de54cd4df472a8f0cd1aba
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/toggle.gif differ
diff --git a/en/application-dev/reference/arkui-ts/figures/touch.gif b/en/application-dev/reference/arkui-ts/figures/touch.gif
deleted file mode 100644
index 021c8dfc90ce80c3ee16acbcb4e06c0ddec6e21e..0000000000000000000000000000000000000000
Binary files a/en/application-dev/reference/arkui-ts/figures/touch.gif and /dev/null differ
diff --git a/en/application-dev/reference/arkui-ts/figures/unnaming-(3).png b/en/application-dev/reference/arkui-ts/figures/unnaming-(3).png
new file mode 100644
index 0000000000000000000000000000000000000000..293ead152f1cde4757f85101d9c8c96bdec4dee7
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/unnaming-(3).png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/unnaming-(4).png b/en/application-dev/reference/arkui-ts/figures/unnaming-(4).png
new file mode 100644
index 0000000000000000000000000000000000000000..e2a8cf9cf4fc88e27e7adb0ad9caf2df9ca978c6
Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/unnaming-(4).png differ
diff --git a/en/application-dev/reference/arkui-ts/ts-animation.md b/en/application-dev/reference/arkui-ts/ts-animation.md
index 1c2ff183affa9a018716b8aa65cfc55d0929ded3..b5406cb67c82d3843280685dfc33bde75a76d689 100644
--- a/en/application-dev/reference/arkui-ts/ts-animation.md
+++ b/en/application-dev/reference/arkui-ts/ts-animation.md
@@ -1,6 +1,6 @@
-# Animation
+# Animation
-- **[AnimatorProperty](ts-animatorproperty.md)**
+- **[Attribute Animation](ts-animatorproperty.md)**
- **[Explicit Animation](ts-explicit-animation.md)**
diff --git a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md
index 9c80650d15fd63aae30a7092bd68970a4b741cbd..1e78fb758a57f820506df5029e8e3283108e602c 100644
--- a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md
+++ b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md
@@ -1,4 +1,7 @@
-# AnimatorProperty
+# Attribute Animation
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
When the universal attributes of a component change, you can create an **AnimatorProperty** for gradient to improve user experience.
diff --git a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md
index 0a6b31dde2b2e5e7d0c75a636afea77289e0b04e..0947abd4085bdedcb912f38a114c22cfacc492c1 100644
--- a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md
+++ b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md
@@ -1,4 +1,4 @@
-# Built-in Enums
+# Built-in Enums
## Alignment Enums
@@ -57,6 +57,28 @@
+## Axis enums
+
+
+ Name
+
+ Description
+
+
+
+ Vertical
+
+ Vertical direction.
+
+
+ Horizontal
+
+ Horizontal direction.
+
+
+
+
+
## ItemAlign Enums
diff --git a/en/application-dev/reference/arkui-ts/ts-appendix.md b/en/application-dev/reference/arkui-ts/ts-appendix.md
index 1c5725e47c6723a680d9a391eabd9e8b635aae04..3ba8ba978eabe4cc2cae5d35bcbd82d57ca61141 100644
--- a/en/application-dev/reference/arkui-ts/ts-appendix.md
+++ b/en/application-dev/reference/arkui-ts/ts-appendix.md
@@ -1,4 +1,4 @@
-# Appendix
+# Appendix
- **[Built-in Enums](ts-appendix-enums.md)**
diff --git a/en/application-dev/reference/arkui-ts/ts-application-states-storagelink-storageprop.md b/en/application-dev/reference/arkui-ts/ts-application-states-storagelink-storageprop.md
deleted file mode 100644
index 3d6aab4ec13cf7fa7d0d9aaed7b1575d008ccf94..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/arkui-ts/ts-application-states-storagelink-storageprop.md
+++ /dev/null
@@ -1,54 +0,0 @@
-# Synchronization Between AppStorage and Components
-
-In [Managing Component States](ts-component-states-state.md), we have defined how to synchronize the state variables of the component with the **@State** annotated variables in the parent component or ancestor component, including **@Prop**, **@Link**, and **@Consume**.
-
-This section describes how to synchronize component variables with the **AppStorage** and mainly covers the **@StorageLink** and **@StorageProp** decorators.
-
-## @StorageLink Decorator
-
-Components decorated by **@StorageLink\(_key_\)** have bidirectional data binding with the **AppStorage**. **key** is the attribute key value in the **AppStorage**. When a component containing the **@StorageLink** annotated variable is created, the value of the variable is initialized using the value in the **AppStorage**. Changes made to the **@StorageLink** annotated variable in the UI component will be synchronized to the **AppStorage** and from the **AppStorage** to any other binding instance, such as **PersistentStorage** or other bound UI components.
-
-## @StorageProp Decorator
-
-Components decorated by **@StorageProp\(_key_\)** have unidirectional data binding with the **AppStorage**. **key** is the attribute key value in the **AppStorage**. When a component containing the **StorageProp** annotated variable is created, the value of the variable is initialized using the value in the **AppStorage**. The change to the attribute value in the **AppStorage** will cause the bound UI component to update the state.
-
-## Example
-
-```
-let varA = AppStorage.Link('varA')
-let envLang = AppStorage.Prop('languageCode')
-
-@Entry
-@Component
-struct ComponentA {
- @StorageLink('varA') varA: number = 2
- @StorageProp('languageCode') lang: string = 'en'
- private label: string = 'count'
-
- private aboutToAppear() {
- this.label = (this.lang === 'zh') ? 'Number' : 'Count'
- }
-
- build() {
- Row({ space: 20 }) {
-
- Button(`${this.label}: ${this.varA}`)
- .onClick(() => {
- AppStorage.Set('varA', AppStorage.Get('varA') + 1)
- })
- Button(`lang: ${this.lang}`)
- .onClick(() => {
- if (this.lang === 'zh') {
- AppStorage.Set('languageCode', 'en')
- } else {
- AppStorage.Set('languageCode', 'zh')
- }
- this.label = (this.lang === 'zh') ? 'Number' : 'Count'
- })
- }
- }
-}
-```
-
-Each time the user clicks the Count button, the value of **this.varA** increases. This variable is synchronized with **varA** in the **AppStorage**. Each time the user clicks the icon indicating the current language, the value of **languageCode** in the **AppStorage** is changed. The change is synchronized to the **this.lang** variable.
-
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-blank.md b/en/application-dev/reference/arkui-ts/ts-basic-components-blank.md
index 311f155eafc0214910546e3ede65e812599c38bd..d005082951b2e5846084878df9a411a3d1fa021b 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-blank.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-blank.md
@@ -1,9 +1,9 @@
-# Blank
-
-The **** component supports automatic filling of the empty part of the container along the main axis.
+# Blank
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- This component is valid only when the parent component is **** or ****.
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+The **** component supports automatic filling of the empty part of the container along the main axis. This component is valid only when the parent component is **** or ****.
## Required Permissions
@@ -86,8 +86,8 @@ struct BlankExample {
Row() {
Text('Bluetooth').fontSize(18)
Blank()
- Text('on/off').fontSize(18).height(60)
- }.width('100%').backgroundColor(0xFFFFFF).borderRadius(15).padding(12)
+ Toggle({ type: ToggleType.Switch })
+ }.width('100%').backgroundColor(0xFFFFFF).borderRadius(15).padding({ left: 12 })
}.backgroundColor(0xEFEFEF).padding(20)
}
}
@@ -95,9 +95,9 @@ struct BlankExample {
Portrait mode
-![](figures/blank_v.gif)
+![](figures/blank1.gif)
Landscape mode
-![](figures/blank_h.gif)
+![](figures/blank2.gif)
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-button.md b/en/application-dev/reference/arkui-ts/ts-basic-components-button.md
index dfe0b0d34742d12314438dc67464308513aa3991..0c017d6aff130f4a59c840646a083283294023cc 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-button.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-button.md
@@ -1,6 +1,9 @@
-# Button
+# Button
-Provides the button component.
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+The **** component represents a component that can trigger actions.
## Required Permissions
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md
index 4da875499d18ac85b3312310fe8c27ebdf94f685..2045636c93f2fba167e4c6c4c84aa699b09efe7f 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md
@@ -1,6 +1,10 @@
-# DataPanel
+# DataPanel
-The **** component display proportions in a ring chart.
+The **** component displays proportions in a chart.
+
+## Required Permissions
+
+None
## Child Components
@@ -8,7 +12,7 @@ None
## APIs
-DataPanel\(value:\{values: number\[\], max?: number\}\)
+DataPanel\(value:\{values: number\[\], max?: number, type?: DataPanelType\}\)
- Parameters
@@ -17,11 +21,11 @@ DataPanel\(value:\{values: number\[\], max?: number\}\)
Type
- Mandatory
+ Mandatory
- Default Value
+ Default Value
- Description
+ Description
@@ -29,22 +33,57 @@ DataPanel\(value:\{values: number\[\], max?: number\}\)
number[]
- Yes
+ Yes
- -
+ -
- Value list. A maximum of nine values are supported.
+ Value list. A maximum of nine values are supported.
max
number
- No
+ No
- 100
+ 100
- Maximum value.
+ 1. When set to a value greater than 0, this parameter indicates the maximum value in the values list.
+ 2. When set to a value equal to or smaller than 0, this parameter indicates the sum of values in the values list. The values are displayed in proportion.
+
+
+ type 8+
+
+ DataPanelType
+
+ No
+
+ DataPanelType.Circle
+
+ Type of the data panel.
+
+
+
+
+
+
+- DataPanelType enums
+
+
+ Name
+
+ Description
+
+
+
+ Line
+
+ Line data panel.
+
+
+ Circle
+
+ Circle data panel.
@@ -57,17 +96,19 @@ DataPanel\(value:\{values: number\[\], max?: number\}\)
@Entry
@Component
struct DataPanelExample {
- public values1: number[] = [40, 20, 20, 10, 10]
+ public values1: number[] = [10, 10, 10, 10, 10, 10, 10, 10, 10]
build() {
Column({ space: 5 }) {
- DataPanel({ values: this.values1, max: 100 })
- .width(150)
- .height(150)
+ Text('Circle').fontSize(9).fontColor(0xCCCCCC).margin({ top: 20, right: '80%' })
+ DataPanel({ values: this.values1, max: 100, type: DataPanelType.Circle }).width(200).height(200)
+
+ Text('Line').fontSize(9).fontColor(0xCCCCCC).margin({ bottom: 20, right: '80%' })
+ DataPanel({ values: this.values1, max: 100, type: DataPanelType.Line }).width(300).height(10)
}.width('100%').margin({ top: 5 })
}
}
```
-![](figures/datapanel.png)
+![](figures/datapanel.jpg)
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md
index 582f46904df95794cc01fcfef0e5b7ed28570bb7..975737f94d718f15edb7ea3e3c37cdaf7998e50a 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md
@@ -1,4 +1,7 @@
-# Divider
+# Divider
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to separate content blocks and content elements.
@@ -101,5 +104,5 @@ struct DividerExample {
}
```
-![](figures/divider.png)
+![](figures/en-us_image_0000001196780640.png)
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md b/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md
new file mode 100644
index 0000000000000000000000000000000000000000..1f6b9bc92c5d1508850b1ee64dd90088e8652c1b
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md
@@ -0,0 +1,152 @@
+# Gauge
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+Data gauge chart widget, which is used to display data in a ring chart.
+
+## Required Permissions
+
+None
+
+## Child Component
+
+N/A
+
+## APIs
+
+Gauge\(value:\{value: number, min?: number, max?: number\}\)
+
+- Parameter
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ value
+
+ number
+
+ Yes
+
+ -
+
+ Current data value.
+
+
+ min
+
+ number
+
+ No
+
+ 0
+
+ Minimum value of the current data segment.
+
+
+ max
+
+ number
+
+ No
+
+ 100
+
+ Maximum value of the current data segment.
+
+
+
+
+
+
+## Attributes
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+ value
+
+ number
+
+ 0
+
+ Sets the value of the current data chart.
+
+
+ startAngle
+
+ Angle
+
+ -150
+
+ Set the start angle. Clock 0 indicates 0 degree, and the clockwise direction indicates the positive angle.
+
+
+ endAngle
+
+ Angle
+
+ 150
+
+ Sets the end angle position. The clock 0 point is 0 degree, and the clockwise direction is the positive angle.
+
+
+ colors
+
+ Color | Array<ColorStop>
+
+ -
+
+ Set the color of the chart. You can set the pure color or segmental gradient color.
+
+
+ strokeWidth
+
+ Length
+
+ -
+
+ Sets the ring thickness of a ring chart.
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct GaugeExample {
+ build() {
+ Column() {
+ Gauge({ value: 50, min: 0, max: 100 })
+ .startAngle(210).endAngle(150)
+ .colors([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1], [0xD94838, 1]])
+ .strokeWidth(20)
+ .width(200).height(200)
+ }.width('100%').margin({ top: 5 })
+ }
+}
+```
+
+![](figures/gauge.png)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md
index 98965b5ba4410851414f183f071a438fccd7e82f..16e50350b5464fe9f7e5f1fc5bdf1a59fa9f9c99 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-image.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-image.md
@@ -1,4 +1,7 @@
-# Image
+# Image
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to render and display images.
@@ -12,7 +15,7 @@ None
## APIs
-Image\(src: string | PixelMap\)
+Image\(value: \{uri: string | PixelMap\}\)
- Parameters
@@ -29,7 +32,7 @@ Image\(src: string | PixelMap\)
- src
+ uri
string
@@ -122,6 +125,15 @@ Image\(src: string | PixelMap\)
+ syncLoad 8+
+
+ boolean
+
+ false
+
+ Whether to load images synchronously. By default, images are loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed.
+
+
@@ -313,7 +325,7 @@ struct ImageExample1 {
}
```
-![](figures/image1.gif)
+![](figures/en-us_image_0000001239925031.gif)
```
// Image2
@@ -382,7 +394,7 @@ struct ImageExample2 {
}
```
-![](figures/image2.gif)
+![](figures/en-us_image_0000001194605518.png)
```
// Image3
@@ -444,5 +456,5 @@ struct ImageExample3 {
}
```
-![](figures/image3.gif)
+![](figures/en-us_image_0000001194942468.gif)
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md b/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md
index d2b5813ea5e0ae210640b287a267f96b1bae5b9b..af1a3aaaa8f9297be8efbb28d8455d4c46f5ab5e 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md
@@ -1,7 +1,14 @@
-# ImageAnimator
+# ImageAnimator
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component enables images to be played frame by frame. The list of images to be played can be configured, and the duration of each image can be configured.
+## Required Permissions
+
+None
+
## Child Components
None
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md b/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md
new file mode 100644
index 0000000000000000000000000000000000000000..5348e4f44d4442d67cc63f1e0491aaa3a0d9976f
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-marquee.md
@@ -0,0 +1,172 @@
+# Marquee
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+The **** component displays single-line scrolling text.
+
+## Required Permissions
+
+None
+
+## Child Components
+
+None
+
+## APIs
+
+Marquee\(value: \{ start: boolean, step?: number, loop?: number, fromStart?: boolean, src: string \}\)
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ start
+
+ boolean
+
+ Yes
+
+ -
+
+ Whether to set the marquee scroll.
+
+
+ step
+
+ number
+
+ No
+
+ 6
+
+ Scroll step of the marquee text.
+
+
+ loop
+
+ number
+
+ No
+
+ -1
+
+ Number of times the marquee scrolls. If the value is less than or equal to 0, the marquee scrolls continuously.
+
+
+ fromStart
+
+ boolean
+
+ No
+
+ true
+
+ Whether the marquee scrolls from the start of the text. If the value is false , the marquee scrolls from the end of the text.
+
+
+ src
+
+ string
+
+ Yes
+
+ -
+
+ Text to be scrolled.
+
+
+
+
+
+
+## Events
+
+
+ Name
+
+ Description
+
+
+
+ onStart(callback: () => void)
+
+ Invoked when scrolling starts.
+
+
+ onBounce(callback: () => void)
+
+ Invoked when scrolling reaches the end.
+
+
+ onFinish(callback: () => void)
+
+ Invoked when scrolling is complete.
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct MarqueeExample {
+ @State start: boolean = false
+ @State fromStart: boolean = true
+ @State step: number = 50
+ @State loop: number = 3
+ @State src: string = "Running Marquee starts rolling"
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Marquee({
+ start: this.start,
+ step: this.step,
+ loop: this.loop,
+ fromStart: this.fromStart,
+ src: this.src
+ })
+ .fontColor(Color.White)
+ .fontSize(50)
+ .allowScale(false)
+ .fontWeight(FontWeight.Bold)
+ .backgroundColor(Color.Black)
+ .margin({bottom:40})
+ .onStart(() => {
+ console.log('Marquee animation complete onStart')
+ })
+ .onBounce(() => {
+ console.log('Marquee animation complete onBounce')
+ })
+ .onFinish(() => {
+ console.log('Marquee animation complete onFinish')
+ })
+ Button('start')
+ .onClick(() => {
+ this.start = true
+ })
+ .width(200)
+ .height(60)
+ .margin({bottom:20})
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/gif-1.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md
index cab522e012d711153b18d481360f0f17e23d76ba..8652d7554cb1d95285770d158fff4df3aa4b8b0b 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md
@@ -1,35 +1,13 @@
-# Progress
+# Progress
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to provide a progress bar that displays the progress of content loading or an operation.
-## Applicable Devices
+## Required Permissions
-
- Phone
-
- Tablet
-
- Head Unit
-
- Smart TV
-
- Wearable
-
-
-
- Yes
-
- Yes
-
- Yes
-
- No
-
- No
-
-
-
-
+None
## Child Components
@@ -39,7 +17,7 @@ None
Progress\(value: \{value: number, total?: number, style?: ProgressStyle\}\)
-Creates a progress bar with a clear progress.
+Creates a progress bar with a specified progress value.
- Parameters
@@ -163,5 +141,5 @@ struct ProgressExample {
}
```
-![](figures/progress-60.png)
+![](figures/progress.png)
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md b/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md
index 1cb8387b82656b626a8f4838fc4f2f8b275ca3d2..05e0575e6178ffe6028062fe936635c48ec99605 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md
@@ -1,8 +1,11 @@
-# QRCode
+# QRCode
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to display QR code information.
-## Permissions Required
+## Required Permissions
None
@@ -12,7 +15,7 @@ None
## APIs
-QRCode\(value: \{value: string\}\)
+QRCode\(value: string\)
- Parameters
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md b/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md
index 03de583d763c8fb1f2f1098da12fee31ebf792db..240dd361951228d2c0202167e6eb3f93218494fc 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md
@@ -1,7 +1,14 @@
-# Rating
+# Rating
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component provides a rating bar.
+## Required Permissions
+
+None
+
## Child Components
None
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md
index 066ff6017ef7a45291da0c9d3289562290483282..009ab92e5a7e8646b6d7ba79b0ce0d34755ac809 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md
@@ -1,14 +1,21 @@
-# Slider
+# Slider
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to quickly adjust settings, such as the volume and brightness.
+## Required Permissions
+
+None
+
## Child Components
None
## APIs
-Slider\(value:\{value?: number, min?: number, max?: number, step?: number, style?: SliderStyle\}\)
+Slider\(value:\{value?: number, min?: number, max?: number, step?: number, style?: SliderStyle, direction?: Axis\}\)
- Parameters
@@ -75,11 +82,22 @@ Slider\(value:\{value?: number, min?: number, max?: number, step?: number, style
No
- Outset
+ SliderStyle.OutSet
Style of the slider.
+ direction 8+
+
+ Axis
+
+ No
+
+ Axis.Horizontal
+
+ Whether the slider moves horizontally or vertically.
+
+
@@ -108,6 +126,8 @@ Slider\(value:\{value?: number, min?: number, max?: number, step?: number, style
## Attributes
+Touch target configuration is not supported.
+
Name
@@ -224,6 +244,8 @@ Among all the universal events, only **OnAppear** and **OnDisAppear** are su
struct SliderExample {
@State outSetValue: number = 40
@State inSetValue: number = 40
+ @State outVerticalSetValue: number = 40
+ @State inVerticalSetValue: number = 40
build() {
Column({ space: 5 }) {
@@ -271,10 +293,57 @@ struct SliderExample {
Text(this.inSetValue.toFixed(0)).fontSize(16)
}
.width('80%')
+
+ Row() {
+ Column() {
+ Text('slider out direction set').fontSize(9).fontColor(0xCCCCCC).width('50%')
+ Slider({
+ value: this.outVerticalSetValue,
+ min: 0,
+ max: 100,
+ step: 1,
+ style: SliderStyle.OutSet,
+ direction: Axis.Vertical
+ })
+ .blockColor(Color.Blue)
+ .trackColor(Color.Gray)
+ .selectedColor(Color.Blue)
+ .showSteps(true)
+ .showTips(true)
+ .onChange((value: number, mode: SliderChangeMode) => {
+ this.outVerticalSetValue = value
+ console.info('value:' + value + 'mode:' + mode.toString())
+ })
+ Text(this.outVerticalSetValue.toFixed(0)).fontSize(16)
+ }.width('50%').height(300)
+
+ Column() {
+ Text('slider in direction set').fontSize(9).fontColor(0xCCCCCC).width('50%')
+ Slider({
+ value: this.inVerticalSetValue,
+ min: 0,
+ max: 100,
+ step: 1,
+ style: SliderStyle.InSet,
+ direction: Axis.Vertical
+ })
+ .blockColor(0xCCCCCC)
+ .trackColor(Color.Black)
+ .selectedColor(0xCCCCCC)
+ .showSteps(false)
+ .showTips(false)
+ .onChange((value: number, mode: SliderChangeMode) => {
+ this.inVerticalSetValue = value
+ console.info('value:' + value + 'mode:' + mode.toString())
+ })
+ Text(this.inVerticalSetValue.toFixed(0)).fontSize(16)
+ }.width('50%').height(300)
+ }
+
}.width('100%').margin({ top: 5 })
}
}
```
-![](figures/sider.gif)
+![](figures/slider.gif)
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-span.md b/en/application-dev/reference/arkui-ts/ts-basic-components-span.md
index 1fee8b43430d37c6553f9a31f8ca0367b3a4576b..5ff2deb2320b6195d66fb3ff38516ff3b59abc3a 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-span.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-span.md
@@ -1,4 +1,7 @@
-# Span
+# Span
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The component is used to display a paragraph of textual information. It can be used only as a child component in the **** component.
@@ -46,7 +49,7 @@ Span\(content: string\)
## Attributes
-The universal attribute methods support only the common text style.
+In addition to the text style attributes, the attributes below are supported.
Name
@@ -89,6 +92,9 @@ The universal attribute methods support only the common text style.
Among all the universal events, only the click event is supported.
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>As the **** component does not have size information, the **target** attribute of the **ClickEvent** object returned by the click event is invalid.
+
## Example
```
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md
index ce38696b7d0fe7506c483362384624e27d2f81df..6973ed419c06f81dc200b425fa815ae79ec41e22 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md
@@ -1,4 +1,7 @@
-# Text
+# Text
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to display a paragraph of textual information.
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
new file mode 100644
index 0000000000000000000000000000000000000000..8ea07e9d812d3895368a806b700121997598e308
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
@@ -0,0 +1,186 @@
+# TextArea
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+Provides the multi-line text input component.
+
+## Required Permissions
+
+None
+
+## Child Component
+
+N/A
+
+## APIs
+
+TextArea\(value?: \{ placeholder?: string \}\)
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ placeholder
+
+ string
+
+ No
+
+ -
+
+ Text displayed when there is no input.
+
+
+
+
+
+
+## Attributes
+
+In addition to the attributes in [Universal Attributes](ts-universal-attributes.md), the following attributes are supported.
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+ placeholderColor
+
+ Color
+
+ -
+
+ Placeholder text color.
+
+
+ placeholderFont
+
+ {
+ size?: number,
+ weight?:number | FontWeight ,
+ family?: string,
+ style?: FontStyle
+ }
+
+ -
+
+ Placeholder text style.
+ size : font size. If the value is of the number type, the unit fp is used. weight : font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is 400 . A larger value indicates a larger font weight. family : font family. Use commas (,) to separate multiple fonts. The priority of the fonts is the sequence in which they are placed. An example value is Arial, sans-serif . style : font style.
+
+
+ textAlign
+
+ TextAlign
+
+ TextAlign.Start
+
+ Sets the text horizontal alignment mode.
+
+
+ caretColor
+
+ Color
+
+ -
+
+ Sets the color of the cursor in the text box.
+
+
+
+
+
+- TextAlign enumeration description
+
+
+ Name
+
+ Description
+
+
+
+ Start
+
+ Aligns the header horizontally.
+
+
+ Center
+
+ Horizontal center alignment.
+
+
+ End
+
+ Align the tail horizontally.
+
+
+
+
+
+
+## Events
+
+
+ Name
+
+ Description
+
+
+
+ onChange(callback: (value: string) => void)
+
+ When the input changes, the callback function is triggered.
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct TextAreaExample {
+ @State text: string = ''
+
+ build() {
+ Column() {
+ TextArea({ placeholder: 'input your word' })
+ .placeholderColor("rgb(0,0,225)")
+ .placeholderFont({ size: 30, weight: 100, family: 'cursive', style: FontStyle.Italic })
+ .textAlign(TextAlign.Center)
+ .caretColor(Color.Blue)
+ .height(50)
+ .fontSize(30)
+ .fontWeight(FontWeight.Bold)
+ .fontFamily("sans-serif")
+ .fontStyle(FontStyle.Normal)
+ .fontColor(Color.Red)
+ .onChange((value: string) => {
+ this.text = value
+ })
+ Text(this.text).width('90%')
+ }
+ }
+}
+```
+
+![](figures/textarea1.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
new file mode 100644
index 0000000000000000000000000000000000000000..c2073e5be95e0abef7bccb498ab11d0d4a014702
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
@@ -0,0 +1,268 @@
+# TextInput
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+The **** component provides single-line text input.
+
+## Required Permissions
+
+None
+
+## Child Components
+
+None
+
+## APIs
+
+TextInput\(value?: \{ placeholder?: string \}\)
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ placeholder
+
+ string
+
+ No
+
+ -
+
+ Text displayed when there is no input.
+
+
+
+
+
+
+## Attributes
+
+In addition to the attributes in [Universal Attributes](ts-universal-attributes.md), the following attributes are supported.
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+ type
+
+InputType
+
+ InputType.Normal
+
+ Input box type.
+
+
+ placeholderColor
+
+ Color
+
+ -
+
+ Placeholder color.
+
+
+ placeholderFont
+
+ {
+ size?: Length,
+ weight?: number | FontWeight ,
+ family?: string,
+ style?: FontStyle
+ }
+
+ -
+
+ Placeholder text style.
+ size : font size. If the value is of the number type, the unit fp is used. weight : font weight. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is 400 . A larger value indicates a larger font weight. family : font family. Use commas (,) to separate multiple fonts. The priority of the fonts is the sequence in which they are placed. An example value is Arial, sans-serif . style : font style.
+
+
+ enterKeyType
+
+EnterKeyType
+
+ EnterKeyType.Done
+
+ How the Enter key is labeled.
+
+
+ caretColor
+
+ Color
+
+ -
+
+ Color of the caret (also known as the text insertion cursor).
+
+
+ maxLength
+
+ number
+
+ -
+
+ Maximum number of characters in the text input.
+
+
+
+
+
+- EnterKeyType enums
+
+
+ Name
+
+ Description
+
+
+
+ Go
+
+ The Enter key is labeled "Go."
+
+
+ Search
+
+ The Enter key is labeled "Search."
+
+
+ Send
+
+ The Enter key is labeled "Send."
+
+
+ Next
+
+ The Enter key is labeled "Next."
+
+
+ Done
+
+ The Enter key is labeled "Done."
+
+
+
+
+
+
+- InputType enums
+
+
+ Name
+
+ Description
+
+
+
+ Normal
+
+ Normal input mode.
+
+
+ Password
+
+ Password input mode.
+
+
+ Email
+
+ Email address input mode.
+
+
+ Number
+
+ Digit input mode.
+
+
+
+
+
+
+## Events
+
+
+ Name
+
+ Description
+
+
+
+ onChange(value: string) => void
+
+ Triggered when the input changes.
+
+
+ onSubmit(callback: (enterKey: EnterKeyType ) => void)
+
+ Triggered when the Enter key on the physical or soft keyboard is pressed.
+
+
+ onEditChanged(callback: (isEditing: boolean) => void)
+
+ Triggered when the input status changes.
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct TextInputTest {
+ @State text: string = ''
+ @State text1: string = ''
+ @State text2: string = ''
+ build() {
+ Column() {
+ TextInput({ placeholder: 'input your word' })
+ .type(InputType.Normal)
+ .placeholderColor(Color.Blue)
+ .placeholderFont({ size: 40, weight: FontWeight.Normal, family: "sans-serif", style: FontStyle.Normal })
+ .enterKeyType(EnterKeyType.Next)
+ .caretColor(Color.Green)
+ .height(60)
+ .fontSize(30)
+ .fontWeight(FontWeight.Bold)
+ .fontFamily("cursive")
+ .fontStyle(FontStyle.Italic)
+ .fontColor(Color.Red)
+ .maxLength(20)
+ .onChange((value: string) => {
+ this.text = value
+ })
+ .onSubmit((enterKey) => {
+ this.text1 = 'onSubmit'
+ })
+ .onEditChanged((isEditing) => {
+ this.text2 = 'onEditChanged'
+ })
+ Text(this.text)
+ Text(this.text1)
+ Text(this.text2)
+ }
+ }
+}
+```
+
+![](figures/textinput1.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md b/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md
new file mode 100644
index 0000000000000000000000000000000000000000..2d4f723cbbf7002e12748e661c13ad3f15345026
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md
@@ -0,0 +1,208 @@
+# Toggle
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Child Components
+
+None
+
+## APIs
+
+Toggle\(options: \{ type: ToggleType, isOn?: boolean \}\)
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ type
+
+ ToggleType
+
+ Yes
+
+ -
+
+ Type of the toggle.
+
+
+ isOn
+
+ boolean
+
+ No
+
+ false
+
+ Initial state of the toggle.
+ NOTE: If isOn is not set during component creation, the selected state can be retained during component reuse. If isOn is set, the selected state needs to be retained during component reuse after the selected state is recorded using an event method.
+
+
+
+
+
+
+
+- ToggleType enums
+
+
+ Name
+
+ Description
+
+
+
+ Checkbox
+
+ A checkbox is provided. The text setting of the child component does not take effect. If the text setting is required, you can place the <Text> component and the current component in the layout component.
+
+
+ Button
+
+ A button is provided. If the text setting is available, the corresponding text content is displayed inside the button.
+
+
+ Switch
+
+ A switch is provided. The text setting of the child component does not take effect. If the text setting is required, you can place the <Text> component and the current component in the layout component.
+
+
+
+
+
+
+## Attributes
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+ selectedColor
+
+ Color
+
+ -
+
+ Background color of the toggle when it is enabled.
+
+
+ switchPointColor
+
+ Color
+
+ -
+
+ Color of the circular slider of the Switch type.
+ NOTE: This attribute is valid only when type is set to ToggleType.Switch .
+
+
+
+
+
+
+## Events
+
+
+ Name
+
+ Description
+
+
+
+ onChange(callback: (isOn: boolean) => void)
+
+ Triggered when the switch status changes.
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct ToggleExample {
+ build() {
+ Column({ space: 10 }) {
+ Text('type: Switch').fontSize(12).fontColor(0xcccccc).width('90%')
+ Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
+ Toggle({ type: ToggleType.Switch, isOn: false })
+ .selectedColor(0xed6f21)
+ .switchPointColor(0xe5ffffff)
+ .onChange((isOn: boolean) => {
+ console.info('Component status:' + isOn)
+ })
+
+ Toggle({ type: ToggleType.Switch, isOn: true })
+ .selectedColor(0x39a2db)
+ .switchPointColor(0xe5ffffff)
+ .onChange((isOn: boolean) => {
+ console.info('Component status:' + isOn)
+ })
+ }
+
+ Text('type: Checkbox').fontSize(12).fontColor(0xcccccc).width('90%')
+ Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
+ Toggle({ type: ToggleType.Checkbox, isOn: false })
+ .size({ width: 28, height: 28 })
+ .selectedColor(0xed6f21)
+ .onChange((isOn: boolean) => {
+ console.info('Component status:' + isOn)
+ })
+
+ Toggle({ type: ToggleType.Checkbox, isOn: true })
+ .size({ width: 28, height: 28 })
+ .selectedColor(0x39a2db)
+ .onChange((isOn: boolean) => {
+ console.info('Component status:' + isOn)
+ })
+ }
+
+ Text('type: Button').fontSize(12).fontColor(0xcccccc).width('90%')
+ Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) {
+ Toggle({ type: ToggleType.Button, isOn: false }) {
+ Text('status button').padding({ left: 12, right: 12 })
+ }
+ .selectedColor(0xed6f21)
+ .onChange((isOn: boolean) => {
+ console.info('Component status:' + isOn)
+ })
+
+ Toggle({ type: ToggleType.Button, isOn: true }) {
+ Text('status button').padding({ left: 12, right: 12 })
+ }
+ .selectedColor(0x39a2db)
+ .onChange((isOn: boolean) => {
+ console.info('Component status:' + isOn)
+ })
+ }
+ }.width('100%').padding(24)
+ }
+}
+```
+
+![](figures/toggle.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components.md b/en/application-dev/reference/arkui-ts/ts-basic-components.md
index 28159001506940dde6005334c6d1d25fb8a11db8..4d256bb16eafa12eaac506f2f931431abc08a772 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components.md
@@ -1,4 +1,4 @@
-# Basic Components
+# Basic Components
- **[Blank](ts-basic-components-blank.md)**
@@ -8,10 +8,14 @@
- **[Divider](ts-basic-components-divider.md)**
+- **[Gauge](ts-basic-components-gauge.md)**
+
- **[Image](ts-basic-components-image.md)**
- **[ImageAnimator](ts-basic-components-imageanimator.md)**
+- **[Marquee](ts-basic-components-marquee.md)**
+
- **[Progress](ts-basic-components-progress.md)**
- **[QRCode](ts-basic-components-qrcode.md)**
@@ -24,4 +28,10 @@
- **[Text](ts-basic-components-text.md)**
+- **[TextArea](ts-basic-components-textarea.md)**
+
+- **[TextInput](ts-basic-components-textinput.md)**
+
+- **[Toggle](ts-basic-components-toggle.md)**
+
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-longpressgesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-longpressgesture.md
index c3c581ff6554f850dacc2e8bfd946e2d0936ba95..ffef167c0a41c16297c6de534e027ff2418031c2 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-longpressgesture.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-longpressgesture.md
@@ -1,4 +1,11 @@
-# LongPressGesture
+# LongPressGesture
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
## APIs
@@ -65,12 +72,12 @@ LongPressGesture\(options?: \{ fingers?: number, repeat?: boolean, duration?: nu
- onAction((event?: GestureEvent ) => void)
+ onAction((event?: LongPressGestureEvent ) => void)
Callback invoked when a long press gesture is recognized.
- onActionEnd((event?: GestureEvent ) => void)
+ onActionEnd((event?: LongPressGestureEvent ) => void)
Callback invoked when the finger used for a long press gesture is lift.
@@ -83,6 +90,30 @@ LongPressGesture\(options?: \{ fingers?: number, repeat?: boolean, duration?: nu
+- LongPressGestureEvent attributes8+
+
+ Inherited from [GestureEvent](ts-gesture-settings.md#table290mcpsimp).
+
+
+ Name
+
+ Type
+
+ Description
+
+
+
+ repeat
+
+ boolean
+
+ Whether the event is repeated.
+
+
+
+
+
+
## Example
```
@@ -99,7 +130,7 @@ struct LongPressGestureExample {
.gesture(
LongPressGesture({ repeat: true })
// Repeatedly triggered when the long press gesture exists.
- .onAction((event: GestureEvent) => {
+ .onAction((event: LongPressGestureEvent) => {
if (event.repeat) { this.count++ }
})
// Triggered when the long press gesture ends.
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md
index abfff531623914a9f908a58325ef9eb97bf00e4a..176c52260ab026e9a4d3e41eb7eb2355220170ea 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md
@@ -1,4 +1,11 @@
-# PanGesture
+# PanGesture
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
## APIs
@@ -156,22 +163,22 @@ PanGestureOption\(options?: \{ fingers?: number, direction?: PanDirection, dista
- onActionStart((event?: GestureEvent ) => void)
+ onActionStart(callback: (event?: PanGestureEvent ) => void)
- Callback for the pan gestures reorganization event.
+ Callback for the pan gestures recognition event.
- onActionUpdate((event?: GestureEvent ) => void)
+ onActionUpdate(callback: (event?: PanGestureEvent ) => void)
Callback for the pan gesture movement event.
- onActionEnd((event?: GestureEvent ) => void)
+ onActionEnd(callback: (event?: PanGestureEvent ) => void)
Callback for fingers pick-up.
- onActionCancel(event: () => void)
+ onActionCancel(callback: () => void)
Callback for the touch cancellation event.
@@ -179,6 +186,37 @@ PanGestureOption\(options?: \{ fingers?: number, direction?: PanDirection, dista
+- PanGestureEvent attributes8+
+
+ Inherited from [GestureEvent](ts-gesture-settings.md#table290mcpsimp).
+
+
+ Name
+
+ Type
+
+ Description
+
+
+
+ offsetX
+
+ number
+
+ Offset of the gesture event, in vp.
+
+
+ offsetY
+
+ number
+
+ Offset of the gesture event, in vp.
+
+
+
+
+
+
## Example
```
@@ -196,10 +234,10 @@ struct PanGestureExample {
.translate({ x: this.offsetX, y: this.offsetY, z: 5 })
.gesture(
PanGesture({})
- .onActionStart((event: GestureEvent) => {
+ .onActionStart((event: PanGestureEvent) => {
console.info('Pan start')
})
- .onActionUpdate((event: GestureEvent) => {
+ .onActionUpdate((event: PanGestureEvent) => {
this.offsetX = event.offsetX
this.offsetY = event.offsetY
})
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pinchgesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pinchgesture.md
index 068a834cb4b67c84bc35919d0c1c8bc522962991..0906de7217ea2259a8aad053fcc0f38ddd4e68f6 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pinchgesture.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pinchgesture.md
@@ -1,4 +1,11 @@
-# PinchGesture
+# PinchGesture
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
## APIs
@@ -54,17 +61,17 @@ PinchGesture\(options?: \{ fingers?: number, distance?: number \}\)
- onActionStart((event?: GestureEvent ) => void)
+ onActionStart((event?: PinchGestureEvent ) => void)
Callback invoked when a pinch gesture is recognized.
- onActionUpdate((event?: GestureEvent ) => void)
+ onActionUpdate((event?: PinchGestureEvent ) => void)
Callback invoked during the movement of a pinch gesture.
- onActionEnd((event?: GestureEvent ) => void)
+ onActionEnd((event?: PinchGestureEvent ) => void)
Callback invoked when the finger used for a pinch gesture is lift.
@@ -77,6 +84,44 @@ PinchGesture\(options?: \{ fingers?: number, distance?: number \}\)
+- PinchGestureEvent attributes8+
+
+ Inherited from [GestureEvent](ts-gesture-settings.md#table290mcpsimp).
+
+
+ Name
+
+ Type
+
+ Description
+
+
+
+ scale
+
+ number
+
+ Scale ratio. This attribute is used for the pinch gesture.
+
+
+ pinchCenterX
+
+ number
+
+ X coordinate of the center of the pinch, in px.
+
+
+ pinchCenterY
+
+ number
+
+ Y coordinate of the center of the pinch, in px.
+
+
+
+
+
+
## Example
```
@@ -93,10 +138,10 @@ struct PinchGestureExample {
.scale({ x: this.scale, y: this.scale, z: this.scale })
.gesture(
PinchGesture()
- .onActionStart((event: GestureEvent) => {
+ .onActionStart((event: PinchGestureEvent) => {
console.info('Pinch start')
})
- .onActionUpdate((event: GestureEvent) => {
+ .onActionUpdate((event: PinchGestureEvent) => {
this.scale = event.scale
})
.onActionEnd(() => {
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-rotationgesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-rotationgesture.md
index 2e07281bbe86874f3a46b17b1a7ff53ac8791026..a5b02f328549297bea12cb3f00c82afd3c77abfc 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-rotationgesture.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-rotationgesture.md
@@ -1,4 +1,11 @@
-# RotationGesture
+# RotationGesture
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
## APIs
@@ -54,17 +61,17 @@ RotationGesture\(options?: \{ fingers?: number, angle?: number \}\)
- onActionStart((event?: GestureEvent ) => void)
+ onActionStart((event?: RotationGestureEvent ) => void)
Callback invoked when a rotation gesture is recognized.
- onActionUpdate((event?: GestureEvent ) => void)
+ onActionUpdate((event?: RotationGestureEvent ) => void)
Callback invoked during the movement of the rotation gesture.
- onActionEnd((event?: GestureEvent ) => void)
+ onActionEnd((event?: RotationGestureEvent ) => void)
Callback invoked when the finger used for the rotation gesture is lift.
@@ -77,6 +84,44 @@ RotationGesture\(options?: \{ fingers?: number, angle?: number \}\)
+- RotationGestureEvent attributes8+
+
+ Inherited from [GestureEvent](ts-gesture-settings.md#table290mcpsimp).
+
+
+ Name
+
+ Type
+
+ Description
+
+
+
+ angle
+
+ number
+
+ Rotation angle.
+
+
+ pinchCenterX
+
+ number
+
+ X coordinate of the center of the pinch, in px.
+
+
+ pinchCenterY
+
+ number
+
+ Y coordinate of the center of the pinch, in px.
+
+
+
+
+
+
## Example
```
@@ -93,10 +138,10 @@ struct RotationGestureExample {
.margin(80).rotate({ x:1, y:2, z:3, angle: this.angle })
.gesture(
RotationGesture()
- .onActionStart((event: GestureEvent) => {
+ .onActionStart((event: RotationGestureEvent) => {
console.log('Rotation start')
})
- .onActionUpdate((event: GestureEvent) => {
+ .onActionUpdate((event: RotationGestureEvent) => {
this.angle = event.angle
})
.onActionEnd(() => {
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-swipegesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-swipegesture.md
new file mode 100644
index 0000000000000000000000000000000000000000..77bb943dc66d8e4a410a25196678f4d914e1ef79
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-swipegesture.md
@@ -0,0 +1,171 @@
+# SwipeGesture
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## APIs
+
+SwipeGesture\(value?: \{ fingers?: number; direction?: SwipeDirection; speed?: number \}\)
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ fingers
+
+ number
+
+ No
+
+ 1
+
+ Minimum number of fingers to trigger a swipe gesture. The value ranges from 1 to 10.
+
+
+ direction
+
+ SwipeDirection
+
+ No
+
+ SwipeDirection.All
+
+ Swipe direction
+
+
+ speed
+
+ number
+
+ No
+
+ 100
+
+ Minimum speed of the swipe operation (100 vp/s).
+
+
+
+
+
+- SwipeDirection enums
+
+
+ Name
+
+ Description
+
+
+
+ All
+
+ All directions.
+
+
+ Horizontal
+
+ Horizontal direction.
+
+
+ Vertical
+
+ Vertical direction.
+
+
+
+
+
+
+## Events
+
+
+ Name
+
+ Description
+
+
+
+ onAction(callback:(event?: SwipeGestureEvent ) => void)
+
+ Callback for the swipe gesture recognition event.
+
+
+
+
+
+- SwipeGestureEvent attributes
+
+ Inherited from [GestureEvent](ts-gesture-settings.md#table290mcpsimp).
+
+
+ Name
+
+ Type
+
+ Description
+
+
+
+ angle
+
+ number
+
+ Angle of the swipe gesture.
+
+
+ speed
+
+ number
+
+ Speed of the swipe gesture.
+
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct SwipeGestureExample {
+ @State rotateAngle : number = 0
+ @State speed : number = 1
+
+ build() {
+ Column() {
+ Text("SwipGesture speed : " + this.speed)
+ Text("SwipGesture angle : " + this.rotateAngle)
+ }
+ .position({x: 80, y: 200})
+ .border({width:2})
+ .width(260).height(260)
+ .rotate({x: 0, y: 0, z: 1, angle: this.rotateAngle})
+ .gesture(
+ SwipeGesture({fingers: 1, direction:SwipeDirection.Vertical})
+ .onAction((event: SwipeGestureEvent) => {
+ this.speed = event.speed
+ this.rotateAngle = event.angle
+ })
+ )
+ }
+}
+```
+
+![](figures/gif-0.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md
index 5b50c3de08dc223ea5a2eea2868bbf988505f66c..79dc179371733d521140bff5f07045ea09372e82 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md
@@ -1,4 +1,11 @@
-# TapGesture
+# TapGesture
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
## APIs
@@ -59,7 +66,7 @@ TapGesture\(options?: \{ count?: number, fingers?: number \}\)
- onAction((event?: GestureEvent ) => void)
+ onAction((event?: TapGestureEvent ) => void)
Callback invoked when a tap gesture is recognized.
@@ -67,6 +74,11 @@ TapGesture\(options?: \{ count?: number, fingers?: number \}\)
+- TapGestureEvent attributes8+
+
+ Inherited from [GestureEvent](ts-gesture-settings.md#table290mcpsimp).
+
+
## Example
```
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures.md
index 560cd68fb12b8859f1f0d52a4b451b02a2e18b6f..1dca7a6b84f0ef88837ed77e3530986a78a8f139 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-gestures.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures.md
@@ -1,4 +1,4 @@
-# Basic Gestures
+# Basic Gestures
- **[TapGesture](ts-basic-gestures-tapgesture.md)**
@@ -10,4 +10,6 @@
- **[RotationGesture](ts-basic-gestures-rotationgesture.md)**
+- **[SwipeGesture](ts-basic-gestures-swipegesture.md)**
+
diff --git a/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
new file mode 100644
index 0000000000000000000000000000000000000000..866df9034fa4f33cfe29801f5a1b691e38413029
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
@@ -0,0 +1,3817 @@
+# CanvasRenderingContext2D
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+Use **RenderingContext** to draw rectangles, text, images, and other objects on a canvas.
+
+## APIs
+
+CanvasRenderingContext2D\(setting: RenderingContextSetting\)
+
+- Parameters
+
+
+
+
+
+### RenderingContextSettings
+
+RenderingContextSettings\(antialias?: bool, alpha?: bool\)
+
+Configures the settings of a **CanvasRenderingContext2D** object, including whether to enable antialiasing and whether to contain an alpha channel.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ antialias
+
+ bool
+
+ No
+
+ false
+
+ Whether antialiasing is enabled.
+
+
+ alpha
+
+ bool
+
+ No
+
+ false
+
+ Whether the canvas contains an alpha channel.
+
+
+
+
+
+
+## Attributes
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+fillStyle
+
+ <color> | CanvasGradient | CanvasPattern
+
+ -
+
+ Style to fill an area.
+When the type is <color> , this parameter indicates the color of the filling area. When the type is CanvasGradient , this parameter indicates a gradient object, which is created using the createLinearGradient method. When the type is CanvasPattern , use the createPattern method to create a pattern.
+
+
+lineWidth
+
+ number
+
+ -
+
+ Line width.
+
+
+strokeStyle
+
+ <color> | CanvasGradient | CanvasPattern
+
+ -
+
+ Stroke style.
+When the type is <color> , this parameter indicates the stroke color. When the type is CanvasGradient , this parameter indicates a gradient object, which is created using the createLinearGradient method. When the type is CanvasPattern , use the createPattern method to create a pattern.
+
+
+lineCap
+
+ string
+
+ 'butt'
+
+ Style of the specified line endpoint. The options are as follows:
+ butt : The endpoints of the line are squared off. round : The endpoints of the line are rounded. square : The endpoints of the line are squared off, and each endpoint has added a rectangle whose length is the same as the line thickness and whose width is half of the line thickness.
+
+
+lineJoin
+
+ string
+
+ 'miter'
+
+ Style of the intersection point between line segments. The options are as follows:
+ 'round' : The intersection is a sector, whose radius at the rounded corner is equal to the line width. 'bevel' : The intersection is a triangle. The rectangular corner of each line is independent. 'miter' : The intersection has a miter corner by extending the outside edges of the lines until they meet. You can view the effect of this attribute in miterLimit .
+
+
+miterLimit
+
+ number
+
+ 10
+
+ Maximum miter length. The miter length is the distance between the inner corner and the outer corner where two lines meet.
+
+
+font
+
+ string
+
+ 'normal normal 14px sans-serif'
+
+ Font style.
+ Syntax: ctx.font="font-size font-family"
+(Optional) font-size : font size and row height. The unit can only be pixels. (Optional) font-family : font family.
+ Syntax: ctx.font="font-style font-weight font-size font-family"
+(Optional) font-style : font style. Available values are 'normal' and 'italic' . (Optional) font-weight : font weight. Available values are as follows: 'normal' , 'bold' , 'bolder' , 'lighter' , 100 , 200 , 300 , 400 , 500 , 600 , 700 , 800 , 900 (Optional) font-size : font size and row height. The unit can only be pixels. (Optional) font-family : font family. Available values are 'sans-serif' , 'serif' , and 'monospace' .
+
+
+textAlign
+
+ string
+
+ 'left'
+
+ Text alignment mode. Available values are as follows:
+ 'left' : The text is left-aligned. 'right' : The text is right-aligned. 'center' : The text is center-aligned. 'start' : The text is aligned with the start bound. 'end' : The text is aligned with the end bound.
+ NOTE: In the ltr layout mode, the value 'start' equals 'left' . In the rtl layout mode, the value 'start' equals 'right' .
+
+
+
+textBaseline
+
+ string
+
+ 'alphabetic'
+
+ Horizontal alignment mode of text. Available values are as follows:
+ 'alphabetic' : The text baseline is the normal alphabetic baseline. 'top' : The text baseline is on the top of the text bounding box. 'hanging' : The text baseline is a hanging baseline over the text. 'middle' : The text baseline is in the middle of the text bounding box. 'ideographic' : The text baseline is the ideographic baseline. If a character exceeds the alphabetic baseline, the ideographic baseline is located at the bottom of the excess character. 'bottom' : The text baseline is at the bottom of the text bounding box. Its difference from the ideographic baseline is that the ideographic baseline does not consider letters in the next line.
+
+
+globalAlpha
+
+ number
+
+ -
+
+ Opacity. 0.0 : completely transparent; 1.0 : completely opaque.
+
+
+lineDashOffset
+
+ number
+
+ 0.0
+
+ Offset of the dashed line. The precision is float.
+
+
+globalCompositeOperation
+
+ string
+
+ 'source-over'
+
+ Composition operation type. Available values are as follows: 'source-over', 'source-atop', 'source-in', 'source-out', 'destination-over', 'destination-atop', 'destination-in', 'destination-out', 'lighter', 'copy', and 'xor'.
+
+
+shadowBlur
+
+ number
+
+ 0.0
+
+ Blur level during shadow drawing. A larger value indicates a more blurred effect. The precision is float.
+
+
+shadowColor
+
+ <color>
+
+ -
+
+ Shadow color.
+
+
+shadowOffsetX
+
+ number
+
+ -
+
+ X-axis shadow offset relative to the original object.
+
+
+shadowOffsetY
+
+ number
+
+ -
+
+ Y-axis shadow offset relative to the original object.
+
+
+imageSmoothingEnabled
+
+ boolean
+
+ true
+
+ Whether to adjust the image smoothness during image drawing. The value true means to enable this feature, and false means the opposite.
+
+
+ imageSmoothingQuality
+
+ string
+
+ 'low'
+
+ Image smoothness. The value can be 'low' , 'medium' , or 'high' .
+
+
+
+
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>The value of the **** type can be in 'rgb\(255, 255, 255\)', 'rgba\(255, 255, 255, 1.0\)', or '\#FFFFFF' format.
+
+### fillStyle
+
+```
+@Entry
+@Component
+struct FillStyleExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.fillStyle = '#0000ff'
+ this.context.fillRect(20, 160, 150, 100)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193322850.png)
+
+### lineWidth
+
+```
+@Entry
+@Component
+struct LineWidthExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.lineWidth = 5
+ this.context.strokeRect(25, 25, 85, 105)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001238402745.png)
+
+### strokeStyle
+
+```
+@Entry
+@Component
+struct StrokeStyleExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.lineWidth = 10
+ this.context.strokeStyle = '#0000ff'
+ this.context.strokeRect(25, 25, 155, 105)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001238282783.png)
+
+### lineCap
+
+```
+@Entry
+@Component
+struct LineCapExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.lineWidth = 8
+ this.context.beginPath()
+ this.context.lineCap = 'round'
+ this.context.moveTo(30, 50)
+ this.context.lineTo(220, 50)
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193642802.png)
+
+### lineJoin
+
+```
+@Entry
+@Component
+struct LineJoinExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.beginPath()
+ this.context.lineWidth = 8
+ this.context.lineJoin = 'miter'
+ this.context.moveTo(30, 30)
+ this.context.lineTo(120, 60)
+ this.context.lineTo(30, 110)
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193802788.png)
+
+### miterLimit
+
+```
+@Entry
+@Component
+struct MiterLimit {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.lineWidth = 8
+ this.context.lineJoin = 'miter'
+ this.context.miterLimit = 3
+ this.context.moveTo(30, 30)
+ this.context.lineTo(60, 35)
+ this.context.lineTo(30, 37)
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001238522733.png)
+
+### font
+
+```
+@Entry
+@Component
+struct Font {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.font = '30px sans-serif'
+ this.context.fillText("Hello World", 20, 60)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193482814.png)
+
+### textAlign
+
+```
+@Entry
+@Component
+struct TextAlign {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.strokeStyle = '#0000ff'
+ this.context.moveTo(140, 10)
+ this.context.lineTo(140, 160)
+ this.context.stroke()
+
+ this.context.font = '18px sans-serif'
+
+ this.context.textAlign = 'start'
+ this.context.fillText('textAlign=start', 140, 60)
+ this.context.textAlign = 'end'
+ this.context.fillText('textAlign=end', 140, 80)
+ this.context.textAlign = 'left'
+ this.context.fillText('textAlign=left', 140, 100)
+ this.context.textAlign = 'center'
+ this.context.fillText('textAlign=center',140, 120)
+ this.context.textAlign = 'right'
+ this.context.fillText('textAlign=right',140, 140)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001238602771.png)
+
+### textBaseline
+
+```
+@Entry
+@Component
+struct TextBaseline {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.strokeStyle = '#0000ff'
+ this.context.moveTo(0, 120)
+ this.context.lineTo(400, 120)
+ this.context.stroke()
+
+ this.context.font = '20px sans-serif'
+
+ this.context.textBaseline = 'top'
+ this.context.fillText('Top', 10, 120)
+ this.context.textBaseline = 'bottom'
+ this.context.fillText('Bottom', 55, 120)
+ this.context.textBaseline = 'middle'
+ this.context.fillText('Middle', 125, 120)
+ this.context.textBaseline = 'alphabetic'
+ this.context.fillText('Alphabetic', 195, 120)
+ this.context.textBaseline = 'hanging'
+ this.context.fillText('Hanging', 295, 120)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193322872.png)
+
+### globalAlpha
+
+```
+@Entry
+@Component
+struct GlobalAlpha {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.fillStyle = 'rgb(255,0,0)'
+ this.context.fillRect(0, 0, 50, 50)
+ this.context.globalAlpha = 0.4
+ this.context.fillStyle = 'rgb(0,0,255)'
+ this.context.fillRect(50, 50, 50, 50)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001238402777.png)
+
+### lineDashOffset
+
+```
+@Entry
+@Component
+struct LineDashOffset {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.arc(100, 75, 50, 0, 6.28)
+ this.context.setLineDash([10,20])
+ this.context.stroke();
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001238282827.png)
+
+### globalCompositeOperation
+
+
+ Name
+
+ Description
+
+
+
+ source-over
+
+ Displays the new drawing above the existing drawing. This attribute is used by default.
+
+
+ source-atop
+
+ Displays the new drawing on the top of the existing drawing.
+
+
+ source-in
+
+ Displays the new drawing inside the existing drawing.
+
+
+ source-out
+
+ Displays the part of the new drawing that is outside of the existing drawing.
+
+
+ destination-over
+
+ Displays the existing drawing above the new drawing.
+
+
+ destination-atop
+
+ Displays the existing drawing above the new drawing.
+
+
+ destination-in
+
+ Displays the existing drawing inside the new drawing.
+
+
+ destination-out
+
+ Displays the part of the existing drawing that is outside of the new drawing.
+
+
+ lighter
+
+ Displays both the new drawing and the existing drawing.
+
+
+ copy
+
+ Displays the new drawing and neglects the existing drawing.
+
+
+ xor
+
+ Combines the new drawing and existing drawing using the XOR operation.
+
+
+
+
+
+```
+@Entry
+@Component
+struct GlobalCompositeOperation {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.fillStyle = 'rgb(255,0,0)'
+ this.context.fillRect(20, 20, 50, 50)
+ this.context.globalCompositeOperation = 'source-over'
+ this.context.fillStyle = 'rgb(0,0,255)'
+ this.context.fillRect(50, 50, 50, 50)
+ this.context.fillStyle = 'rgb(255,0,0)'
+ this.context.fillRect(120, 20, 50, 50)
+ this.context.globalCompositeOperation = 'destination-over'
+ this.context.fillStyle = 'rgb(0,0,255)'
+ this.context.fillRect(150, 50, 50, 50)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193642848.png)
+
+### shadowBlur
+
+```
+@Entry
+@Component
+struct ShadowBlur {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true);
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.shadowBlur = 30
+ this.context.shadowColor = 'rgb(0,0,0)'
+ this.context.fillStyle = 'rgb(255,0,0)'
+ this.context.fillRect(20, 20, 100, 80)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193802836.png)
+
+### shadowColor
+
+```
+@Entry
+@Component
+struct ShadowColor {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.shadowBlur = 30
+ this.context.shadowColor = 'rgb(0,0,255)'
+ this.context.fillStyle = 'rgb(255,0,0)'
+ this.context.fillRect(30, 30, 100, 100)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001238522783.png)
+
+### shadowOffsetX
+
+```
+@Entry
+@Component
+struct ShadowOffsetX {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.shadowBlur = 10
+ this.context.shadowOffsetX = 20
+ this.context.shadowColor = 'rgb(0,0,0)'
+ this.context.fillStyle = 'rgb(255,0,0)'
+ this.context.fillRect(20, 20, 100, 80)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193482866.png)
+
+### shadowOffsetY
+
+```
+@Entry
+@Component
+struct ShadowOffsetY {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.shadowBlur = 10
+ this.context.shadowOffsetY = 20
+ this.context.shadowColor = 'rgb(0,0,0)'
+ this.context.fillStyle = 'rgb(255,0,0)'
+ this.context.fillRect(30, 30, 100, 100)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001238602821.png)
+
+### imageSmoothingEnabled
+
+```
+@Entry
+@Component
+struct ImageSmoothingEnabled {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private img:ImageBitmap = new ImageBitmap("common/images/icon.jpg")
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.imageSmoothingEnabled = false
+ this.context.drawImage( this.img,0,0,400,200)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193322910.png)
+
+## Methods
+
+### fillRect
+
+fillRect\(x: number, y: number, w: number, h: number\): void
+
+Fills a rectangle on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle.
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the rectangle.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the rectangle.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct FillRect {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.fillRect(0,30,100,100)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193737314.png)
+
+
+### strokeRect
+
+strokeRect\(x: number, y: number, w: number, h: number\): void
+
+Draws a rectangle stroke on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle stroke.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle stroke.
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the rectangle.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the rectangle.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct StrokeRect {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.strokeRect(30, 30, 200, 150)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238457271.png)
+
+
+### clearRect
+
+clearRect\(x: number, y: number, w: number, h: number\): void
+
+Clears the content in a rectangle on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle.
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the rectangle.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the rectangle.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct ClearRect {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.fillStyle = 'rgb(0,0,255)'
+ this.context.fillRect(0,0,500,500)
+ this.context.clearRect(20,20,150,100)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/11111.png)
+
+
+### fillText
+
+fillText\(text: string, x: number, y: number\): void
+
+Draws filled text on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ text
+
+ string
+
+ Yes
+
+ ""
+
+ Text to draw.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the lower left corner of the text.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the lower left corner of the text.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct FillText {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.font = '30px sans-serif'
+ this.context.fillText("Hello World!", 20, 100)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238537297.png)
+
+
+### strokeText
+
+strokeText\(text: string, x: number, y: number\): void
+
+Draws a text stroke on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ text
+
+ string
+
+ Yes
+
+ ""
+
+ Text to draw.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the lower left corner of the text.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the lower left corner of the text.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct StrokeText {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.font = '55px sans-serif'
+ this.context.strokeText("Hello World!", 20, 60)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193756416.png)
+
+
+### measureText
+
+measureText\(text: string\): TextMetrics
+
+Returns a **TextMetrics** object used to obtain the width of specified text.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ text
+
+ string
+
+ Yes
+
+ ""
+
+ Text to be measured.
+
+
+
+
+
+
+- Return values
+
+
+ Type
+
+ Description
+
+
+
+ TextMetrics
+
+ TextMetrics object.
+
+
+
+
+
+- **TextMetrics** attributes
+
+
+ Attribute
+
+ Type
+
+ Description
+
+
+
+ width
+
+ number
+
+ Width of the text string.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct MeasureText {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.font = '50px sans-serif'
+ this.context.fillText("Hello World!", 20, 100)
+ this.context.fillText("width:" + this.context.measureText("Hello World!").width, 20, 200)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238476361.png)
+
+
+### stroke
+
+stroke\(path?: Path2D\): void
+
+Strokes a path.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ path
+
+ Path2D
+
+ No
+
+ null
+
+ A Path2D path to draw.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Stroke {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.moveTo(25, 25)
+ this.context.lineTo(25, 105)
+ this.context.strokeStyle = 'rgb(0,0,255)'
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193436448.png)
+
+
+### beginPath
+
+beginPath\(\): void
+
+Creates a drawing path.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct BeginPath {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.beginPath()
+ this.context.lineWidth = 6
+ this.context.strokeStyle = '#0000ff'
+ this.context.moveTo(15, 80)
+ this.context.lineTo(280, 160)
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238556395.png)
+
+
+### moveTo
+
+moveTo\(x: number, y: number\): void
+
+Moves a drawing path to a target position on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the target position.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the target position.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct MoveTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.beginPath()
+ this.context.moveTo(10, 10)
+ this.context.lineTo(280, 160)
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193481094.png)
+
+
+### lineTo
+
+lineTo\(x: number, y: number\): void
+
+Connects the current point to a target position using a straight line.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the target position.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the target position.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct LineTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.beginPath()
+ this.context.moveTo(10, 10)
+ this.context.lineTo(280, 160)
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238601051.png)
+
+
+### closePath
+
+closePath\(\): void
+
+Draws a closed path.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct ClosePath {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.beginPath()
+ this.context.moveTo(30, 30)
+ this.context.lineTo(110, 30)
+ this.context.lineTo(70, 90)
+ this.context.closePath()
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193321136.png)
+
+
+### createPattern
+
+createPattern\(image: ImageBitmap, repetition: string\): void
+
+Creates a pattern for image filling based on a specified source image and repetition mode.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ image
+
+ ImageBitmap
+
+ Yes
+
+ null
+
+ Source image. For details, see ImageBitmap .
+
+
+ repetition
+
+ string
+
+ Yes
+
+ ""
+
+ Repetition mode. The value can be 'repeat' , 'repeat-x' , 'repeat-y' , or 'no-repeat' .
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct CreatePattern {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private img:ImageBitmap = new ImageBitmap("common/images/icon.jpg")
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ var pattern = this.context.createPattern(this.img, 'repeat')
+ this.context.fillStyle = pattern
+ this.context.fillRect(0, 0, 200, 200)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238401029.png)
+
+
+### bezierCurveTo
+
+bezierCurveTo\(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number\): void
+
+Draws a cubic bezier curve on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ cp1x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the first parameter of the bezier curve.
+
+
+ cp1y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the first parameter of the bezier curve.
+
+
+ cp2x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the second parameter of the bezier curve.
+
+
+ cp2y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the second parameter of the bezier curve.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the end point on the bezier curve.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the end point on the bezier curve.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct BezierCurveTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.beginPath()
+ this.context.moveTo(10, 10)
+ this.context.bezierCurveTo(20, 100, 200, 100, 200, 20)
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238281067.png)
+
+
+### quadraticCurveTo
+
+quadraticCurveTo\(cpx: number, cpy: number, x: number, y: number\): void
+
+Draws a quadratic curve on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ cpx
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the bezier curve parameter.
+
+
+ cpy
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the bezier curve parameter.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the end point on the bezier curve.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the end point on the bezier curve.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct QuadraticCurveTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true);
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.beginPath();
+ this.context.moveTo(20, 20);
+ this.context.quadraticCurveTo(100, 100, 200, 20);
+ this.context.stroke();
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193641084.png)
+
+
+### arc
+
+arc\(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean\): void
+
+Draws an arc on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the center point of the arc.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the center point of the arc.
+
+
+ radius
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the arc.
+
+
+ startAngle
+
+ number
+
+ Yes
+
+ 0
+
+ Start radian of the arc.
+
+
+ endAngle
+
+ number
+
+ Yes
+
+ 0
+
+ End radian of the arc.
+
+
+ anticlockwise
+
+ boolean
+
+ No
+
+ false
+
+ Whether to draw the arc counterclockwise.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Arc {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.beginPath()
+ this.context.arc(100, 75, 50, 0, 6.28)
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193801070.png)
+
+
+### arcTo
+
+arcTo\(x1: number, y1: number, x2: number, y2: number, radius: number\): void
+
+Draws an arc based on the radius and points on the arc.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x1
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the first point on the arc.
+
+
+ y1
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the first point on the arc.
+
+
+ x2
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the second point on the arc.
+
+
+ y2
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the second point on the arc.
+
+
+ radius
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the arc.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct ArcTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.moveTo(100, 20);
+ this.context.arcTo(150, 20, 150, 70, 50);
+ this.context.stroke();
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238521019.png)
+
+
+### ellipse
+
+ellipse\(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean\): void
+
+Draws an ellipse in the specified rectangular region.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the ellipse center.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the ellipse center.
+
+
+ radiusX
+
+ number
+
+ Yes
+
+ 0
+
+ Ellipse radius on the x-axis.
+
+
+ radiusY
+
+ number
+
+ Yes
+
+ 0
+
+ Ellipse radius on the y-axis.
+
+
+ rotation
+
+ number
+
+ Yes
+
+ 0
+
+ Rotation angle of the ellipse, in radians.
+
+
+ startAngle
+
+ number
+
+ Yes
+
+ 0
+
+ Angle of the start point for drawing the ellipse, in radians.
+
+
+ endAngle
+
+ number
+
+ Yes
+
+ 0
+
+ Angle of the end point for drawing the ellipse, in radians.
+
+
+ anticlockwise
+
+ number
+
+ No
+
+ 0
+
+ Whether to draw the ellipse in the counterclockwise direction. The value 0 means to draw the ellipse in the clockwise direction, and 1 means to draw the ellipse in the counterclockwise direction. This parameter is optional. The default value is 0 .
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Ellipse {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.beginPath()
+ this.context.ellipse(200, 200, 50, 100, Math.PI * 0.25, Math.PI * 0.5, Math.PI, true)
+ this.context.stroke()
+ })
+ Button('back')
+ .onClick(() => {
+ router.back()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193481096.png)
+
+
+### rect
+
+rect\(x: number, y: number, width: number, height: number\): void
+
+Creates a rectangle.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle.
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the rectangle.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the rectangle.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Rect {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.rect(20, 20, 100, 100) // Create a 100*100 rectangle at (20, 20)
+ this.context.stroke()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238601053.png)
+
+
+### fill
+
+fill\(\): void
+
+Fills the area inside a closed path.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Fill {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.rect(20, 20, 100, 100) // Create a 100*100 rectangle at (20, 20)
+ this.context.fill()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193321138.png)
+
+
+### clip
+
+clip\(\): void
+
+Sets the current path to a clipping path.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Clip {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.rect(0, 0, 200, 200)
+ this.context.stroke()
+ this.context.clip()
+ this.context.fillStyle = "rgb(255,0,0)"
+ this.context.fillRect(0, 0, 150, 150)
+ })
+ Button('back')
+ .onClick(() => {
+ router.back()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238401031.png)
+
+
+### rotate
+
+rotate\(rotate: number\): void
+
+Rotates a canvas clockwise around its coordinate axes.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ rotate
+
+ number
+
+ Yes
+
+ 0
+
+ Clockwise rotation angle. You can use Math.PI / 180 to convert the angle to a radian.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Rotate {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.rotate(45 * Math.PI / 180) // Rotate the rectangle 45 degrees
+ this.context.fillRect(70, 20, 50, 50)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238281069.png)
+
+
+### scale
+
+scale\(x: number, y: number\): void
+
+Scales a canvas based on scaling factors.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ Horizontal scale factor.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Vertical scale factor.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Scale {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.strokeRect(10, 10, 25, 25)
+ this.context.scale(2, 2) // Scale to 200%
+ this.context.strokeRect(10, 10, 25, 25)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193641086.png)
+
+
+### transform
+
+transform\(scaleX: number, skewX: number, skewY: number, scaleY: number, translateX: number, translateY: number\): void
+
+Defines a transformation matrix. To transform a graph, you only need to set parameters of the matrix. The coordinates of the graph are multiplied by the matrix values to obtain new coordinates of the transformed graph. You can use the matrix to implement multiple transform effects.
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>The following formulas calculate coordinates of the transformed graph. **x** and **y** represent coordinates before transformation, and **x'** and **y'** represent coordinates after transformation.
+>- x' = scaleX \* x + skewY \* y + translateX
+>- y' = skewX \* x + scaleY \* y + translateY
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ scaleX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis scale.
+
+
+ skewX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis skew.
+
+
+ skewY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis skew.
+
+
+ scaleY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis scale.
+
+
+ translateX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis translation.
+
+
+ translateY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis translation.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Transform {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.fillStyle = 'rgb(0,0,0)'
+ this.context.fillRect(0, 0, 100, 100)
+ this.context.transform(1, 0.5, -0.5, 1, 10, 10)
+ this.context.fillStyle = 'rgb(255,0,0)'
+ this.context.fillRect(0, 0, 100, 100)
+ this.context.transform(1, 0.5, -0.5, 1, 10, 10)
+ this.context.fillStyle = 'rgb(0,0,255)'
+ this.context.fillRect(0, 0, 100, 100)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193801072.png)
+
+
+### setTransform
+
+setTransform\(scaleX: number, skewX: number, skewY: number, scale: number, translateX: number, translateY: number\): void
+
+Resets the existing transformation matrix and creates a new transformation matrix by using the same parameters as the **transform\(\)** function.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ scaleX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis scale.
+
+
+ skewX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis skew.
+
+
+ skewY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis skew.
+
+
+ scaleY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis scale.
+
+
+ translateX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis translation.
+
+
+ translateY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis translation.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct SetTransform {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.fillStyle = 'rgb(255,0,0)'
+ this.context.fillRect(0, 0, 100, 100)
+ this.context.setTransform(1,0.5, -0.5, 1, 10, 10)
+ this.context.fillStyle = 'rgb(0,0,255)'
+ this.context.fillRect(0, 0, 100, 100)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001238521021.png)
+
+
+### translate
+
+translate\(x: number, y: number\): void
+
+Moves the origin of the coordinate system.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis translation
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis translation.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Translate {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.fillRect(10, 10, 50, 50)
+ this.context.translate(70, 70)
+ this.context.fillRect(10, 10, 50, 50)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193481098.png)
+
+
+### drawImage
+
+drawImage\(image: ImageBitmap, dx: number, dy: number\): void
+
+drawImage\(image: ImageBitmap, dx: number, dy: number, dWidth: number, dHeight: number\): void
+
+drawImage\(image: ImageBitmap, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number\):void
+
+Draws an image.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ image
+
+ ImageBitmap
+
+ Yes
+
+ null
+
+ Image resource. For details, see ImageBitmap .
+
+
+ sx
+
+ number
+
+ No
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle used to crop the source image.
+
+
+ sy
+
+ number
+
+ No
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle used to crop the source image.
+
+
+ sWidth
+
+ number
+
+ No
+
+ 0
+
+ Target width to crop the source image.
+
+
+ sHeight
+
+ number
+
+ No
+
+ 0
+
+ Target height to crop the source image.
+
+
+ dx
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the drawing area on the canvas.
+
+
+ dy
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the drawing area on the canvas.
+
+
+ dWidth
+
+ number
+
+ No
+
+ 0
+
+ Width of the drawing area.
+
+
+ dHeight
+
+ number
+
+ No
+
+ 0
+
+ Height of the drawing area.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct ImageExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true);
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings);
+ private img:ImageBitmap = new ImageBitmap("common/images/example.jpg");
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.drawImage( this.img,0,0,500,500,0,0,400,200);
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192915154.png)
+
+
+### createImageData
+
+createImageData\(width: number, height: number\): Object
+
+Creates an **ImageData** object. For details, see [ImageData](ts-components-canvas-imagedata.md).
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default
+
+ Description
+
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the ImageData object.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the ImageData object.
+
+
+
+
+
+
+### createImageData
+
+createImageData\(imageData: Object\): Object
+
+Creates an **ImageData** object. For details, see [ImageData](ts-components-canvas-imagedata.md).
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default
+
+ Description
+
+
+
+ imagedata
+
+ Object
+
+ Yes
+
+ null
+
+ ImageData object with the same width and height copied from the original ImageData object.
+
+
+
+
+
+
+### getImageData
+
+getImageData\(sx: number, sy: number, sw: number, sh: number\): Object
+
+Creates an [ImageData](ts-components-canvas-imagedata.md) object with pixels in the specified area on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ sx
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the output area.
+
+
+ sy
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the output area.
+
+
+ sw
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the output area.
+
+
+ sh
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the output area.
+
+
+
+
+
+
+### putImageData
+
+putImageData\(imageData: Object, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number\): void
+
+Puts the [ImageData](ts-components-canvas-imagedata.md) onto a rectangular area on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ imagedata
+
+ Object
+
+ Yes
+
+ null
+
+ ImageData object with pixels to put onto the canvas.
+
+
+ dx
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis offset of the rectangular area on the canvas.
+
+
+ dy
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis offset of the rectangular area on the canvas.
+
+
+ dirtyX
+
+ number
+
+ No
+
+ 0
+
+ X-axis offset of the upper left corner of the rectangular area relative to that of the source image.
+
+
+ dirtyY
+
+ number
+
+ No
+
+ 0
+
+ Y-axis offset of the upper left corner of the rectangular area relative to that of the source image.
+
+
+ dirtyWidth
+
+ number
+
+ No
+
+ Width of the ImageData object
+
+ Width of the rectangular area to crop the source image.
+
+
+ dirtyHeight
+
+ number
+
+ No
+
+ Height of the ImageData object
+
+ Height of the rectangular area to crop the source image.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct PutImageData {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ var imageData = this.context.createImageData(100, 100)
+ for (var i = 0; i < imageData.data.length; i += 4) {
+ imageData.data[i + 0] = 255
+ imageData.data[i + 1] = 0
+ imageData.data[i + 2] = 255
+ imageData.data[i + 3] = 255
+ }
+ this.context.putImageData(imageData, 10, 10)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193075134.png)
+
+
+### restore
+
+restore\(\): void
+
+Restores the saved drawing context.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Restore {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.controller.restore()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+
+### save
+
+save\(\): void
+
+Saves the current drawing context.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Restore {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.save()
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+
+### createLinearGradient
+
+createLinearGradient\(x0: number, y0: number, x1: number, y1: number\): void
+
+Creates a linear gradient.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x0
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the start point.
+
+
+ y0
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the start point.
+
+
+ x1
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the end point.
+
+
+ y1
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the end point.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct CreateLinearGradient {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private gra:CanvasGradient = new CanvasGradient()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ var grad = this.context.createLinearGradient(50,0, 300,100)
+ this.gra.addColorStop(0.0, 'red')
+ this.gra.addColorStop(0.5, 'white')
+ this.gra.addColorStop(1.0, 'green')
+ this.context.fillStyle = grad
+ this.context.fillRect(0, 0, 500, 500)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237555149.png)
+
+
+### createRadialGradient
+
+createRadialGradient\(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number\): void
+
+Creates a linear gradient.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x0
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the center of the start circle.
+
+
+ y0
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the center of the start circle.
+
+
+ r0
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the start circle, which must be a non-negative finite number.
+
+
+ x1
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the center of the end circle.
+
+
+ y1
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the center of the end circle.
+
+
+ r1
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the end circle, which must be a non-negative finite number.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct CreateRadialGradient {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private gra:CanvasGradient = new CanvasGradient()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ var grad = this.context.createRadialGradient(200,200,50, 200,200,200)
+ this.gra.addColorStop(0.0, 'red')
+ this.gra.addColorStop(0.5, 'white')
+ this.gra.addColorStop(1.0, 'green')
+ this.context.fillStyle = grad
+ this.context.fillRect(0, 0, 500, 500)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192755188.png)
+
+
+## CanvasPattern
+
+Defines an object created by using the [createPattern](#section1643216163371) method.
+
diff --git a/en/application-dev/reference/arkui-ts/ts-combined-gestures.md b/en/application-dev/reference/arkui-ts/ts-combined-gestures.md
index df706686c6cc65d1e492f7fc404ebd97c64871d2..bbcfb02bb9daa3fc81bf01a900c2ad8315238d69 100644
--- a/en/application-dev/reference/arkui-ts/ts-combined-gestures.md
+++ b/en/application-dev/reference/arkui-ts/ts-combined-gestures.md
@@ -1,4 +1,11 @@
-# Combined Gestures
+# Combined Gestures
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This gesture is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
## APIs
diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md
new file mode 100644
index 0000000000000000000000000000000000000000..2a193c594a664d6a902bc4d04648138bee1dba08
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md
@@ -0,0 +1,101 @@
+# Canvas
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+The **** component can be used to customize drawings.
+
+## Required Permissions
+
+None
+
+## Child Components
+
+None
+
+## APIs
+
+Canvas\(context: CanvasRenderingContext2D\)
+
+- Parameters
+
+
+
+
+
+## Attributes
+
+[Universal attributes](ts-universal-attributes-size.md) are supported.
+
+## Events
+
+In addition to [universal events](ts-universal-events-click.md), the following events are supported.
+
+
+ Name
+
+ Parameter
+
+ Description
+
+
+
+ onReady(callback: () => void)
+
+ None
+
+ Triggered when .
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct CanvasExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.fillRect(0,30,100,100)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md
new file mode 100644
index 0000000000000000000000000000000000000000..2e1895ded8a48065898a5a8c86c9523157bccce0
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md
@@ -0,0 +1,87 @@
+# CanvasGradient
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+**CanvasGradient** provides a gradient object.
+
+## addColorStop
+
+addColorStop\(offset: number, color: string\): void
+
+Adds a color stop for the **CanvasGradient** object based on the specified offset and gradient color.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ offset
+
+ number
+
+ Yes
+
+ 0
+
+ Proportion of the distance between the color stop and the start point to the total length. The value ranges from 0 to 1.
+
+
+ color
+
+ string
+
+ Yes
+
+ 'ffffff'
+
+ Gradient color to set.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Page45 {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private gra:CanvasGradient = new CanvasGradient()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ var grad = this.context.createLinearGradient(50,0, 300,100)
+ this.gra.addColorStop(0.0, 'red')
+ this.gra.addColorStop(0.5, 'white')
+ this.gra.addColorStop(1.0, 'green')
+ this.context.fillStyle = grad
+ this.context.fillRect(0, 0, 500, 500)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192915130.png)
+
+
diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md
new file mode 100644
index 0000000000000000000000000000000000000000..6c7546ec9f56539adefca6e30cdd3bbbd5075cbc
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md
@@ -0,0 +1,109 @@
+# ImageBitmap
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+**ImageBitmap** allows you to add an image bitmap.
+
+## APIs
+
+ImageBitmap\(src: string\)
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ src
+
+ string
+
+ Yes
+
+ -
+
+ Path of the image bitmap object.
+
+
+
+
+
+
+## Attributes
+
+
+ Attribute
+
+ Type
+
+ Default Value
+
+ Mandatory
+
+ Description
+
+
+
+ width
+
+ Length
+
+ 0px
+
+ No
+
+ Image width.
+
+
+ height
+
+ Length
+
+ 0px
+
+ No
+
+ Image height.
+
+
+
+
+
+Example
+
+```
+@Entry
+@Component
+struct DrawImageExample {
+ private settings:RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private img:ImageBitmap = new ImageBitmap("common/images/example.jpg")
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.context.drawImage( this.img,0,0,400,200)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001192595194.png)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md
new file mode 100644
index 0000000000000000000000000000000000000000..43aa9147a1cad5c71649bac3f948aa1fc09675b6
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md
@@ -0,0 +1,42 @@
+# ImageData
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+**CanvasImageData** stores pixel data rendered on a canvas.
+
+## Attributes
+
+
+ Attribute
+
+ Type
+
+ Description
+
+
+
+ width
+
+ number
+
+ Actual width of the rectangle on the canvas, in pixels.
+
+
+ height
+
+ number
+
+ Actual height of the rectangle on the canvas, in pixels.
+
+
+ data
+
+ <Uint8ClampedArray>
+
+ A one-dimensional array of color values. The values range from 0 to 255.
+
+
+
+
+
diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-lottie.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-lottie.md
new file mode 100644
index 0000000000000000000000000000000000000000..b2a63e4de072dc9aebade58e2caeec761a522240
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-lottie.md
@@ -0,0 +1,1343 @@
+# Lottie
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+Lottie is a third-party open-source library and depends on **Canvas** and **RenderingContext**.
+
+## Required Permissions
+
+None
+
+## Modules to Import
+
+```
+import lottie from 'lottie-web'
+```
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>**'lottie-web'** is subject to the actual released name.
+
+## lottie.loadAnimation
+
+loadAnimation\(
+
+path: string, container: object, render: string, loop: boolean, autoplay: boolean, name: string \): AnimationItem
+
+Loads an animation. Before calling this method, declare the **Animator\('\_\_lottie\_ets'\)** object and check that the canvas layout is complete. This method can be used together with a lifecycle callback of the **Canvas** component, for example, **onAppear\(\)** and **onPageShow\(\)**.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ path
+
+ string
+
+ Yes
+
+ Path of the animation resource file in the HAP file. The resource file must be in JSON format. Example: path: "common/lottie/data.json" .
+
+
+ container
+
+ object
+
+ Yes
+
+ Canvas drawing context. A CanvasRenderingContext2D object must be declared in advance.
+
+
+ render
+
+ string
+
+ Yes
+
+ Rendering type. Only canvas is supported.
+
+
+ loop
+
+ boolean | number
+
+ No
+
+ If the value is of the Boolean type, this parameter indicates whether to repeat the animation cyclically after the animation ends; the default value is true . If the value is of the number type and is greater than or equal to 1, this parameter indicates the number of times the animation plays.
+
+
+ autoplay
+
+ boolean
+
+ No
+
+ Whether to automatically play the animation. The default value is true .
+
+
+ name
+
+ string
+
+ No
+
+ Custom animation name. In later versions, the name can be used to reference and control the animation. The default value is null.
+
+
+ initialSegment
+
+ [number, number]
+
+ No
+
+ Start frame and end frame of the animation, respectively.
+
+
+
+
+
+
+## lottie.destroy
+
+destroy\(name: string\): void
+
+Destroys the animation. This method must be called when a page exits. This method can be used together with a lifecycle callback of the **Canvas** component, for example, **onDisappear\(\)** and **onPageHide\(\)**.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ Yes
+
+ Name of the animation to destroy, which is the same as the name in the loadAnimation interface. By default, all animations are destroyed.
+
+
+
+
+
+- Example
+
+ ```
+ import lottie from 'lottie-web'
+
+ @Entry
+ @Component
+ struct Index {
+ private controller: CanvasRenderingContext2D = new CanvasRenderingContext2D()
+ private animateName: string = "animate"
+ private animatePath: string = "common/lottie/data.json"
+ private animateItem: any = null
+
+ private onPageHide(): void {
+ console.log('onPageHide')
+ lottie.destroy()
+ }
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.controller)
+ .width('30%')
+ .height('20%')
+ .backgroundColor('#0D9FFB')
+ .onAppear(() => {
+ console.log('canvas onAppear');
+ this.animateItem = lottie.loadAnimation({
+ container: this.controller,
+ renderer: 'canvas',
+ loop: true,
+ autoplay: true,
+ name: this.animateName,
+ path: this.animatePath,
+ })
+ })
+
+ Animator('__lottie_ets') // declare Animator('__lottie_ets') when use lottie
+ Button('load animation')
+ .onClick(() => {
+ if (this.animateItem != null) {
+ this.animateItem.destroy()
+ this.animateItem = null
+ }
+ this.animateItem = lottie.loadAnimation({
+ container: this.controller,
+ renderer: 'canvas',
+ loop: true,
+ autoplay: true,
+ name: this.animateName,
+ path: this.animatePath,
+ initialSegment: [10, 50],
+ })
+ })
+
+ Button('destroy animation')
+ .onClick(() => {
+ lottie.destroy(this.animateName)
+ this.animateItem = null
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/lottie-ark-2-0-canvas-ui-animate.gif)
+
+
+## lottie.play
+
+play\(name: string\): void
+
+Plays a specified animation.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ Yes
+
+ Name of the animation to play, which is the same as the name in the loadAnimation interface. By default, all animations are played.
+
+
+
+
+
+- Example
+
+ ```
+ lottie.play(this.animateName)
+ ```
+
+
+## lottie.pause
+
+pause\(name: string\): void
+
+Pauses a specified animation. The next time **lottie.play\(\)** is called, the animation starts from the current frame.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ Yes
+
+ Name of the animation to pause, which is the same as the name in the loadAnimation interface. By default, all animations are paused.
+
+
+
+
+
+- Example
+
+ ```
+ lottie.pause(this.animateName)
+ ```
+
+
+## lottie.togglePause
+
+togglePause\(name: string\): void
+
+Pauses or plays a specified animation. This method is equivalent to the switching between **lottie.play\(\)** and **lottie.pause\(\)**.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ Yes
+
+ Name of the target animation, which is the same as the name in the loadAnimation interface. By default, all animations are paused.
+
+
+
+
+
+- Example
+
+ ```
+ lottie.togglePause(this.animateName)
+ ```
+
+
+## lottie.stop
+
+stop\(name: string\): void
+
+Stops the specified animation. The next time **lottie.play\(\)** is called, the animation starts from the first frame.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ Yes
+
+ Name of the animation to stop, which is the same as the name in the loadAnimation interface. By default, all animations are stopped.
+
+
+
+
+
+- Example
+
+ ```
+ lottie.stop(this.animateName)
+ ```
+
+
+## lottie.setSpeed
+
+setSpeed\(speed: number, name: string\): void
+
+Sets the playback speed of the specified animation.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ speed
+
+ number
+
+ Yes
+
+ Playback speed. The value is a floating-point number. If the value is greater than 0, the animation plays in forward direction. If the value is less than 0, the animation plays in reversed direction. If the value is 0, the animation is paused. If the value is 1.0 or -1.0, the animation plays at the normal speed.
+
+
+ name
+
+ string
+
+ Yes
+
+ Name of the target animation, which is the same as the name in the loadAnimation interface. By default, all animations are stopped.
+
+
+
+
+
+- Example
+
+ ```
+ lottie.setSpeed(5, this.animateName)
+ ```
+
+
+## lottie.setDirection
+
+setDirection\(direction: AnimationDirection, name: string\): void
+
+Sets the dierection in which the specified animation plays.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ direction
+
+ AnimationDirection
+
+ Yes
+
+ Direction in which the animation plays. 1 : forwards; -1 : backwards. When set to play backwards, the animation plays from the current playback progress to the first frame. When this setting is combined with loop being set to true , the animation plays backwards continuously. When the value of speed is less than 0, the animation also plays backwards.
+ AnimationDirection: 1 | -1
+
+
+ name
+
+ string
+
+ Yes
+
+ Name of the target animation, which is the same as the name in the loadAnimation interface. By default, all animations are set.
+
+
+
+
+
+
+- Example
+
+ ```
+ lottie.setDirection(-1, this.controlName)
+ ```
+
+
+## AnimationItem
+
+Defines an **AnimationItem** object, which is returned by the **loadAnimation** interface and has attributes and interfaces. The attributes are described as follows:
+
+
+ Name
+
+ Type
+
+ Description
+
+
+
+ name
+
+ string
+
+ Animation name.
+
+
+ isLoaded
+
+ boolean
+
+ Whether the animation is loaded.
+
+
+ currentFrame
+
+ number
+
+ Frame that is being played. The default precision is a floating-point number greater than or equal to 0.0. After setSubframe(false) is called, the value is a positive integer without decimal points.
+
+
+ currentRawFrame
+
+ number
+
+ Number of frames that are being played. The precision is a floating point number greater than or equal to 0.0.
+
+
+ firstFrame
+
+ number
+
+ First frame of the animation segment that is being played.
+
+
+ totalFrames
+
+ number
+
+ Total number of frames in the animation segment that is being played.
+
+
+ frameRate
+
+ number
+
+ Frame rate (frame/s).
+
+
+ frameMult
+
+ number
+
+ Frame rate (frame/ms).
+
+
+ playSpeed
+
+ number
+
+ Playback speed. The value is a floating-point number. If the value is greater than 0, the animation plays in forward direction. If the value is less than 0, the animation plays in reversed direction. If the value is 0, the animation is paused. If the value is 1.0 or -1.0 , the animation plays at the normal speed.
+
+
+ playDirection
+
+ number
+
+ Playback direction. The options are 1 (forward) and -1 (backward).
+
+
+ playCount
+
+ number
+
+ Number of times the animation plays.
+
+
+ isPaused
+
+ boolean
+
+ Whether the current animation is paused. The value true means that the animation is paused.
+
+
+ autoplay
+
+ boolean
+
+ Whether to automatically play the animation upon completion of the loading. The value false means that the play() interface needs to be called to start playing.
+
+
+ loop
+
+ boolean | number
+
+ If the value is of the Boolean type, this parameter indicates whether to repeat the animation cyclically after the animation ends. If the value is of the number type and is greater than or equal to 1, this parameter indicates the number of times the animation plays.
+
+
+ renderer
+
+ any
+
+ Animation rendering object, which depends on the rendering type.
+
+
+ animationID
+
+ string
+
+ Animation ID.
+
+
+ timeCompleted
+
+ number
+
+ Number of frames that are played for an animation sequence. The value is affected by the setting of AnimationSegment and is the same as the value of totalFrames .
+
+
+ segmentPos
+
+ number
+
+ ID of the current animation segment. The value is a positive integer greater than or equal to 0.
+
+
+ isSubframeEnabled
+
+ boolean
+
+ Whether the precision of currentFrame is a floating point number.
+
+
+ segments
+
+ AnimationSegment | AnimationSegment[]
+
+ Current segment of the animation.
+
+
+
+
+
+## AnimationItem.play
+
+play\(name?: string\): void
+
+Plays an animation.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ No
+
+ Name of the target animation. By default, the value is null.
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.play()
+ ```
+
+
+## AnimationItem.destroy
+
+destroy\(name?: string\): void
+
+Destroys an animation.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ No
+
+ Name of the target animation. By default, the value is null.
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.destroy()
+ ```
+
+
+## AnimationItem.pause
+
+pause\(name?: string\): void
+
+Pauses an animation. When the **play** interface is called next time, the animation is played from the current frame.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ No
+
+ Name of the target animation. By default, the value is null.
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.pause()
+ ```
+
+
+## AnimationItem.togglePause
+
+togglePause\(name?: string\): void
+
+Pauses or plays an animation. This method is equivalent to the switching between **play** and **pause**.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ No
+
+ Name of the target animation. By default, the value is null.
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.togglePause()
+ ```
+
+
+## AnimationItem.stop
+
+stop\(name?: string\): void
+
+Stops an animation. When the **play** interface is called next time, the animation is played from the first frame.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ string
+
+ No
+
+ Name of the target animation. By default, the value is null.
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.stop()
+ ```
+
+
+## AnimationItem.setSpeed
+
+setSpeed\(speed: number\): void
+
+Sets the playback speed of an animation.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ speed
+
+ number
+
+ Yes
+
+ Playback speed. The value is a floating-point number. If the value is greater than 0, the animation plays in forward direction. If the value is less than 0, the animation plays in reversed direction. If the value is 0, the animation is paused. If the value is 1.0 or -1.0 , the animation plays at the normal speed.
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.setSpeed(5);
+ ```
+
+
+## AnimationItem.setDirection
+
+setDirection\(direction: AnimationDirection\): void
+
+Sets the playback direction of an animation.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ direction
+
+ AnimationDirection
+
+ Yes
+
+ Direction in which the animation plays. 1 : forwards; -1 : backwards. When set to play backwards, the animation plays from the current playback progress to the first frame. When this setting is combined with loop being set to true , the animation plays backwards continuously. When the value of speed is less than 0, the animation also plays backwards.
+ AnimationDirection: 1 | -1.
+
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.setDirection(-1)
+ ```
+
+
+## AnimationItem.goToAndStop
+
+goToAndStop\(value: number, isFrame: boolean\): void
+
+Sets the animation to stop at the specified frame or time.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ value
+
+ number
+
+ Yes
+
+ Frame ID (greater than or equal to 0) or time progress (ms) at which the animation will stop.
+
+
+ isFrame
+
+ boolean
+
+ No
+
+ Whether to set the animation to stop at the specified frame. The value true means to set the animation to stop at the specified frame, and false means to set the animation to stop at the specified time progress. The default value is false .
+
+
+ name
+
+ string
+
+ No
+
+ Name of the target animation. By default, the value is null.
+
+
+
+
+
+
+- Example
+
+ ```
+ // Set the animation to stop at the specified frame.
+ this.anim.goToAndStop(25, true)
+ // Set the animation to stop at the specified time progress.
+ this.anim.goToAndStop(300, false, this.animateName)
+ ```
+
+
+## AnimationItem.goToAndPlay
+
+goToAndPlay\(value: number, isFrame: boolean\): void
+
+Sets the animation to start from the specified frame or time progress.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ value
+
+ number
+
+ Yes
+
+ Frame ID (greater than or equal to 0) or time progress (ms) at which the animation will start.
+
+
+ isFrame
+
+ boolean
+
+ Yes
+
+ Whether to set the animation to start from the specified frame. The value true means to set the animation to start from the specified frame, and false means to set the animation to start from the specified time progress. The default value is false .
+
+
+ name
+
+ string
+
+ No
+
+ Name of the target animation. By default, the value is null.
+
+
+
+
+
+
+- Example
+
+ ```
+ // Set the animation to start from the specified frame.
+ this.anim.goToAndPlay(25, true)
+ // Set the animation to start from the specified time progress.
+ this.anim.goToAndPlay(300, false, this.animateName)
+ ```
+
+
+## AnimationItem.playSegments
+
+playSegments\(segments: AnimationSegment | AnimationSegment\[\], forceFlag: boolean\): void
+
+Sets the animation to play only the specified segment.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ segments
+
+ AnimationSegment = [number, number] | AnimationSegment[]
+
+ Yes
+
+ Segment or segment list.
+ If all segments in the segment list are played, only the last segment is played in the next cycle.
+
+
+ forceFlag
+
+ boolean
+
+ Yes
+
+ Whether the settings take effect immediately. The value true means the settings take effect immediately, and false means the settings take effect until the current cycle of playback is completed.
+
+
+
+
+
+
+- Example
+
+ ```
+ // Set the animation to play the specified segment.
+ this.anim.playSegments([10, 20], false)
+ // Set the animation to play the specified segment list.
+ this.anim.playSegments([[0, 5], [20, 30]], true)
+ ```
+
+
+## AnimationItem.resetSegments
+
+resetSegments\(forceFlag: boolean\): void
+
+Resets the settings configured by the **playSegments** method to play all the frames.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ forceFlag
+
+ boolean
+
+ Yes
+
+ Whether the settings take effect immediately. The value true means the settings take effect immediately, and false means the settings take effect until the current cycle of playback is completed.
+
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.resetSegments(true)
+ ```
+
+
+## AnimationItem.resize
+
+resize\(\): void
+
+Refreshes the animation layout.
+
+- Example
+
+ ```
+ this.anim.resize()
+ ```
+
+
+## AnimationItem.setSubframe
+
+setSubframe\(useSubFrame: boolean\): void
+
+Sets the precision of the **currentFrame** attribute to display floating-point numbers.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ useSubFrames
+
+ boolean
+
+ Yes
+
+ Whether the currentFrame attribute displays floating-point numbers. By default, the attribute displays floating-point numbers.
+ true : The currentFrame attribute displays floating-point numbers.
+ false : The currentFrame attribute displays an integer and does not display floating-point numbers.
+
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.setSubframe(false)
+ ```
+
+
+## AnimationItem.getDuration
+
+getDuration\(inFrames?: boolean\): void
+
+Obtains the duration \(irrelevant to the playback speed\) or number of frames for playing an animation sequence. The settings are related to the input parameter **initialSegment** of the **Lottie.loadAnimation** interface.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ inFrames
+
+ boolean
+
+ No
+
+ Whether to obtain the duration or number of frames. true : number of frames. false : duration, in ms. The default value is false .
+
+
+
+
+
+
+- Example
+
+ ```
+ this.anim.setSubframe(true)
+ ```
+
+
+## AnimationItem.addEventListener
+
+addEventListener\(name: AnimationEventName, callback: AnimationEventCallback\): \(\) =\> void
+
+Adds an event listener. After the event is complete, the specified callback function is triggered. This method returns the function object that can delete the event listener.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ AnimationEventName
+
+ Yes
+
+ Animation event type. The available options are as follows:
+ 'enterFrame', 'loopComplete', 'complete', 'segmentStart', 'destroy', 'config_ready', 'data_ready', 'DOMLoaded', 'error', 'data_failed', 'loaded_images'
+
+
+ callback
+
+ AnimationEventCallback<T>
+
+ Yes
+
+ Custom callback.
+
+
+
+
+
+
+- Example
+
+ ```
+ private callbackItem: any = function() {
+ console.log("grunt loopComplete")
+ }
+ let delFunction = this.animateItem.addEventListener('loopComplete', this.callbackItem)
+
+ // Delete the event listener.
+ delFunction()
+ ```
+
+
+## AnimationItem.removeEventListener
+
+removeEventListener\(name: AnimationEventName, callback?: AnimationEventCallback\): void
+
+Deletes an event listener.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ AnimationEventName
+
+ Yes
+
+ Animation event type. The available options are as follows:
+ 'enterFrame', 'loopComplete', 'complete', 'segmentStart', 'destroy', 'config_ready', 'data_ready', 'DOMLoaded', 'error', 'data_failed', 'loaded_images'
+
+
+ callback
+
+ AnimationEventCallback<T>
+
+ Yes
+
+ Custom callback. By default, the value is null, meaning that all callbacks of the event will be removed.
+
+
+
+
+
+
+- Example
+
+ ```
+ this.animateItem.removeEventListener('loopComplete', this.callbackItem)
+ ```
+
+
+## AnimationItem.triggerEvent
+
+triggerEvent\(name: AnimationEventName, args: T\): void
+
+Directly triggers all configured callbacks of a specified event.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Description
+
+
+
+ name
+
+ AnimationEventName
+
+ Yes
+
+ Animation event type.
+
+
+
+ args
+
+ any
+
+ Yes
+
+ Custom callback parameters.
+
+
+
+
+
+
+- Example
+
+ ```
+ private triggerCallBack: any = function(item) {
+ console.log("trigger loopComplete, name:" + item.name)
+ }
+
+ this.animateItem.addEventListener('loopComplete', this.triggerCallBack)
+ this.animateItem.triggerEvent('loopComplete', this.animateItem)
+ this.animateItem.removeEventListener('loopComplete', this.triggerCallBack)
+ ```
+
+
diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md
new file mode 100644
index 0000000000000000000000000000000000000000..3cf2b4df5c04552bbde5c5d5810162e272fdcd2d
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md
@@ -0,0 +1,959 @@
+# Path2D
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+**Path2D** allows you to describe a path through an existing path. This path can be drawn through the **stroke** API of **Canvas**.
+
+## addPath
+
+addPath\(path: Object\): void
+
+Adds a path to this path.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ path
+
+ Object
+
+ Yes
+
+ null
+
+ Path to be added to this path.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct AddPath {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+
+ private path2Da: Path2D = new Path2D("M250 150 L150 350 L350 350 Z")
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.addPath(this.path2Da)
+ this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192595216.png)
+
+
+## closePath
+
+closePath\(\): void
+
+Moves the current point of the path back to the start point of the path, and draws a straight line between the current point and the start point. If the shape is closed or has only one point, this method does not perform any action.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct ClosePath {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.moveTo(200, 100)
+ this.path2Db.lineTo(300, 100)
+ this.path2Db.lineTo(200, 200)
+ this.path2Db.closePath()
+ this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/unnaming-(4).png)
+
+
+## moveTo
+
+moveTo\(x: number, y: number\): void
+
+Moves the current coordinate point of the path to the target point, without drawing a line during the movement.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the target point.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the target point.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct MoveTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.moveTo(50, 100)
+ this.path2Db.lineTo(250, 100)
+ this.path2Db.lineTo(150, 200)
+ this.path2Db.closePath()
+ this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237475113.png)
+
+
+## lineTo
+
+lineTo\(x: number, y: number\): void
+
+Draws a straight line from the current point to the target point.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the target point.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the target point.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct LineTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.moveTo(100, 100)
+ this.path2Db.lineTo(100, 200)
+ this.path2Db.lineTo(200, 200)
+ this.path2Db.lineTo(200, 100)
+ this.path2Db.closePath()
+ this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/unnaming-(3).png)
+
+
+## bezierCurveTo
+
+bezierCurveTo\(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number\): void
+
+Draws a cubic bezier curve on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ cp1x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the first parameter of the bezier curve.
+
+
+ cp1y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the first parameter of the bezier curve.
+
+
+ cp2x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the second parameter of the bezier curve.
+
+
+ cp2y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the second parameter of the bezier curve.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the end point on the bezier curve.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the end point on the bezier curve.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct BezierCurveTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.moveTo(10, 10)
+ this.path2Db.bezierCurveTo(20, 100, 200, 100, 200, 20);this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192915158.png)
+
+
+## quadraticCurveTo
+
+quadraticCurveTo\(cpx: number, cpy: number, x: number ,y: number\): void
+
+Draws a quadratic curve on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ cpx
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the bezier curve parameter.
+
+
+ cpy
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the bezier curve parameter.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the end point on the bezier curve.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the end point on the bezier curve.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct QuadraticCurveTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.moveTo(10, 10)
+ this.path2Db.quadraticCurveTo(100, 100, 200, 20)
+ this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237555151.png)
+
+
+## arc
+
+arc\(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: number\): void
+
+Draws an arc on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the center point of the arc.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the center point of the arc.
+
+
+ radius
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the arc.
+
+
+ startAngle
+
+ number
+
+ Yes
+
+ 0
+
+ Start radian of the arc.
+
+
+ endAngle
+
+ number
+
+ Yes
+
+ 0
+
+ End radian of the arc.
+
+
+ anticlockwise
+
+ boolean
+
+ No
+
+ false
+
+ Whether to draw the arc counterclockwise.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Arc {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.arc(100, 75, 50, 0, 6.28);this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192595214.png)
+
+
+## arcTo
+
+arcTo\(x1: number, y1: number, x2: number, y2: number, radius: number\): void
+
+Draws an arc based on the radius and points on the arc.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x1
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the first point on the arc.
+
+
+ y1
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the first point on the arc.
+
+
+ x2
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the second point on the arc.
+
+
+ y2
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the second point on the arc.
+
+
+ radius
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the arc.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct ArcTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.arcTo(150, 20, 150, 70, 50)
+ this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192755172.png)
+
+
+## ellipse
+
+ellipse\(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: number\): void
+
+Draws an ellipse in the specified rectangular region.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the ellipse center.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the ellipse center.
+
+
+ radiusX
+
+ number
+
+ Yes
+
+ 0
+
+ Ellipse radius on the x-axis.
+
+
+ radiusY
+
+ number
+
+ Yes
+
+ 0
+
+ Ellipse radius on the y-axis.
+
+
+ rotation
+
+ number
+
+ Yes
+
+ 0
+
+ Rotation angle of the ellipse, in radians.
+
+
+ startAngle
+
+ number
+
+ Yes
+
+ 0
+
+ Angle of the start point for drawing the ellipse, in radians.
+
+
+ endAngle
+
+ number
+
+ Yes
+
+ 0
+
+ Angle of the end point for drawing the ellipse, in radians.
+
+
+ anticlockwise
+
+ number
+
+ No
+
+ 0
+
+ Whether to draw the ellipse in the counterclockwise direction. The value 0 means to draw the ellipse in the clockwise direction, and 1 means to draw the ellipse in the counterclockwise direction. This parameter is optional. The default value is 0 .
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Ellipse {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.ellipse(200, 200, 50, 100, Math.PI * 0.25, Math.PI * 0.5, Math.PI, true)
+ this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193075154.png)
+
+
+## rect
+
+rect\(x: number, y: number, width: number, height: number\): void
+
+Creates a rectangle.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle.
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the rectangle.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the rectangle.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Rect {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private path2Db: Path2D = new Path2D()
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.path2Db.rect(20, 20, 100, 100);this.context.stroke(this.path2Db)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192755174.png)
+
+
diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas.md b/en/application-dev/reference/arkui-ts/ts-components-canvas.md
new file mode 100644
index 0000000000000000000000000000000000000000..c28d94e917737bd4625cb335bf388ae50bc7b5f9
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-components-canvas.md
@@ -0,0 +1,19 @@
+# Canvas Components
+
+- **[Canvas](ts-components-canvas-canvas.md)**
+
+- **[CanvasRenderingContext2D](ts-canvasrenderingcontext2d.md)**
+
+- **[OffscreenCanvasRenderingConxt2D](ts-offscreencanvasrenderingcontext2d.md)**
+
+- **[Lottie](ts-components-canvas-lottie.md)**
+
+- **[Path2D](ts-components-canvas-path2d.md)**
+
+- **[CanvasGradient](ts-components-canvas-canvasgradient.md)**
+
+- **[ImageBitmap](ts-components-canvas-imagebitmap.md)**
+
+- **[ImageData](ts-components-canvas-imagedata.md)**
+
+
diff --git a/en/application-dev/reference/arkui-ts/ts-components-container.md b/en/application-dev/reference/arkui-ts/ts-components-container.md
index 4445ee2bd3f38f13d092285a8836600f88a089dd..3350d2b43e33b0334e4f45ae321cc1bce612d93e 100644
--- a/en/application-dev/reference/arkui-ts/ts-components-container.md
+++ b/en/application-dev/reference/arkui-ts/ts-components-container.md
@@ -1,4 +1,4 @@
-# Container Components
+# Container Components
- **[AlphabetIndexer](ts-container-alphabet-indexer.md)**
@@ -24,6 +24,8 @@
- **[Navigator](ts-container-navigator.md)**
+- **[Navigation](ts-container-navigation.md)**
+
- **[Panel](ts-container-panel.md)**
- **[Row](ts-container-row.md)**
@@ -32,6 +34,8 @@
- **[Scroll](ts-container-scroll.md)**
+- **[ScrollBar](ts-container-scrollbar.md)**
+
- **[Stack](ts-container-stack.md)**
- **[Swiper](ts-container-swiper.md)**
@@ -40,4 +44,8 @@
- **[TabContent](ts-container-tabcontent.md)**
+- **[Stepper](ts-container-stepper.md)**
+
+- **[StepperItem](ts-container-stepperitem.md)**
+
diff --git a/en/application-dev/reference/arkui-ts/ts-components.md b/en/application-dev/reference/arkui-ts/ts-components.md
index 8aa235447aa565e0b349feb4559857b588626018..6dd3d6a512fa63959867b3c52e47aba7349f8f06 100644
--- a/en/application-dev/reference/arkui-ts/ts-components.md
+++ b/en/application-dev/reference/arkui-ts/ts-components.md
@@ -1,4 +1,4 @@
-# Components
+# Components
- **[Universal Components](ts-universal-components.md)**
@@ -8,4 +8,6 @@
- **[Drawing Components](ts-drawing-components.md)**
+- **[Canvas Components](ts-components-canvas.md)**
+
diff --git a/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md b/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md
index d1da4616f83919aa329d35cc9e4f332f89c4b32c..4009d2f45471877baaf05483dee27055009169a1 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md
@@ -1,36 +1,39 @@
-# AlphabetIndexer
+# AlphabetIndexer
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component provides an alphabetic index bar.
## Applicable Devices
- Phone
-
- Tablet
+ Phone
- Head Unit
+ Tablet
- Smart TV
+ Smart TV
- Wearable
+ Wearable
- Yes
-
- Yes
+ Yes
- Yes
+ Yes
- No
+ No
- No
+ No
+## Required Permissions
+
+None
+
## Child Components
None
@@ -213,7 +216,18 @@ AlphabetIndexer\(value: \{arrayValue : Array, selected : number\}\)
onSelected(index: number) => void
- Callback invoked when an item in the alphabetic indexer bar is selected.
+ Invoked when an item in the alphabetic indexer bar is selected.
+
+
+ onRequestPopupData(callback: (index: number) => Array<string>) 8+
+
+ Invoked when a request for displaying content in the index prompt window is sent when an item in the alphabetic indexer bar is selected.
+ The return value is a string array corresponding to the indexes. The string array is displayed vertically in the pop-up window. It can display up to five strings at a time and allows scrolling.
+
+
+ onPopupSelected(callback: (index: number) => void) 8+
+
+ Invoked when an item in the index prompt window is selected.
@@ -228,7 +242,7 @@ struct AlphabetIndexerComponent {
private value: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
build() {
- AlphabetIndexer({ ArrayValue: this.value, selected: 0 })
+ AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.selectedColor(0xffffff) // Font color of the selected text
.popupColor(0xFFFAF0) // Font color of the pop-up text
.selectedBackgroundColor(0xCCCCCC) // Background color of the selected text
diff --git a/en/application-dev/reference/arkui-ts/ts-container-badge.md b/en/application-dev/reference/arkui-ts/ts-container-badge.md
index a53a877249391b25599bd123030518bb17153354..ccb15c953951d277547b7db473e5e642e6cad89f 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-badge.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-badge.md
@@ -1,7 +1,14 @@
-# Badge
+# Badge
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component presents event information on a component.
+## Required Permissions
+
+None
+
## Child Components
This component supports only one child component.
diff --git a/en/application-dev/reference/arkui-ts/ts-container-column.md b/en/application-dev/reference/arkui-ts/ts-container-column.md
index 350aac920610e78b2d7d4d1719982aa52ac5568d..5aebfdd7cac87423d8c1494108b354a22bd3c8ae 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-column.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-column.md
@@ -1,4 +1,7 @@
-# Column
+# Column
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component lays out child components vertically.
@@ -12,7 +15,7 @@ This component can contain child components.
## APIs
-Column\(options?: \{ space?: Length \}\)
+Column\(value:\{space?: Length\}\)
- Parameters
diff --git a/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md b/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md
index 4da457e800af742c7b12ff14e795086d9083421a..362c327301ae8d94d92a47637bd08f841557e7ba 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md
@@ -1,7 +1,14 @@
-# ColumnSplit
+# ColumnSplit
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** lays out child components vertically and inserts a horizontal divider between every two child components.
+## Required Permissions
+
+None
+
## Child Components
This component can contain child components.
diff --git a/en/application-dev/reference/arkui-ts/ts-container-counter.md b/en/application-dev/reference/arkui-ts/ts-container-counter.md
index 618584427ee71bb2c601d6639622245f92662694..5a4c49aa9a83320590730fe01d32949eb2eaa732 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-counter.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-counter.md
@@ -1,12 +1,19 @@
-# Counter
+# Counter
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component provides an operation to increase or decrease the number.
+## Required Permissions
+
+None
+
## Child Components
This component can contain child components.
-## API
+## APIs
Counter\(\)
@@ -21,12 +28,12 @@ Universal events and gestures are not supported. Only the events listed below ar
- onInc(callback: () => void)
+ onInc(event: () => void)
Event indicating that the number of monitored objects is increased.
- onDec(callback: () => void)
+ onDec(event: () => void)
Event indicating that the number of monitored objects is decreased.
diff --git a/en/application-dev/reference/arkui-ts/ts-container-flex.md b/en/application-dev/reference/arkui-ts/ts-container-flex.md
index e80339eb43124a7f51805610718a7efc0c2b71e8..e548366843bb3bc04feac69c5050642858b0bc1b 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-flex.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-flex.md
@@ -1,4 +1,7 @@
-# Flex
+# Flex
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component allows for an elastic layout.
@@ -12,7 +15,7 @@ This component can contain child components.
## APIs
-Flex\(options?: \{ direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: FlexAlign, alignItems?: ItemAlign, alignContent?: FlexAlign \}\)
+Flex\(options?: \{ direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: FlexAlign, alignItems?: ItemAlign, alignContent?: FlexAlign \}\)
Creates a standard **** component.
@@ -402,7 +405,7 @@ struct FlexExample4 {
![](figures/flex04.jpg)
-![](figures/flex04-61.gif)
+![](figures/flex04-2.gif)
```
// Example 05
diff --git a/en/application-dev/reference/arkui-ts/ts-container-grid.md b/en/application-dev/reference/arkui-ts/ts-container-grid.md
index afb863a95afe949110c4c3ca601c314564c8dca0..6d142f9eec1c3bb7a631f05611e7f82806129f3a 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-grid.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-grid.md
@@ -1,4 +1,7 @@
-# Grid
+# Grid
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is a two-dimensional layout. The component is divided into rows and columns, to form cells. You can specify the cell where an item is located and combine different grids to form various layouts.
@@ -69,15 +72,15 @@ Grid\(\)
## Events
- Name
+ Name
- Description
+ Description
- onScrollIndex(first: number) => void
+ onScrollIndex(first: number) => void
- Triggered when the start item of the grid changes.
+ Triggered when the start item of the grid changes.
@@ -144,5 +147,5 @@ struct GridExample {
}
```
-![](figures/grid-62.gif)
+![](figures/grid-3.gif)
diff --git a/en/application-dev/reference/arkui-ts/ts-container-gridcontainer.md b/en/application-dev/reference/arkui-ts/ts-container-gridcontainer.md
index b4df55cd1a50f0ca0c1e8553fc3e7ef8c6072e50..034b5719ead7182bf945a2640366583a458e4755 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-gridcontainer.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-gridcontainer.md
@@ -1,14 +1,21 @@
-# GridContainer
+# GridContainer
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component lays out components vertically. It is used only in the grid layout.
+## Required Permissions
+
+None
+
## Child Components
This component can contain child components.
## APIs
-GridContainer\(options? :\{ columns?: number | 'auto', sizeType?: SizeType, gutter?: Length, margin?: Length \}\)
+GridContainer\(options?: \{ columns?: number | 'auto', sizeType?: SizeType, gutter?: Length, margin?: Length\}\)
- Parameter
diff --git a/en/application-dev/reference/arkui-ts/ts-container-griditem.md b/en/application-dev/reference/arkui-ts/ts-container-griditem.md
index 24ef6d0b140293d5615a415342fa1d04ff268a55..a839e1cb6b9b0be44c627a26b873745b20d3c9b2 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-griditem.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-griditem.md
@@ -1,4 +1,7 @@
-# GridItem
+# GridItem
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component provides a single item in a grid.
diff --git a/en/application-dev/reference/arkui-ts/ts-container-list.md b/en/application-dev/reference/arkui-ts/ts-container-list.md
index efaaaea97b3a4ce2293dc1b32623b2e3e7e92a73..fffebb7e5072c2bbce95200fb5091f265b874e80 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-list.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-list.md
@@ -1,4 +1,7 @@
-# List
+# List
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component provides a list container that presents a series of list items arranged in a column with the same width. It supports presentations of the same type of data in a multiple and coherent row style, for example, images or text.
@@ -12,7 +15,7 @@ This component contains the child component [](ts-container-listitem
## APIs
-List\(options?: \{ space?: number, initialIndex?: number \}\)
+List\(value:\{space?: number, initialIndex?: number\}\)
- Parameters
@@ -70,7 +73,7 @@ List\(options?: \{ space?: number, initialIndex?: number \}\)
listDirection
-Axis
+Axis
Vertical
@@ -126,29 +129,6 @@ List\(options?: \{ space?: number, initialIndex?: number \}\)
-- Axis enums
-
-
- Name
-
- Description
-
-
-
- Vertical
-
- The list items are vertically arranged.
-
-
- Horizontal
-
- The list items are horizontally arranged.
-
-
-
-
-
-
- EdgeEffect enums
@@ -175,20 +155,64 @@ List\(options?: \{ space?: number, initialIndex?: number \}\)
## Events
- Name
+ Name
- Description
+ Description
- onItemDelete(index: number) => boolean
+ onItemDelete(index: number) => boolean
- Triggered when a list item is deleted.
+ Triggered when a list item is deleted.
- onScrollIndex(firstIndex: number, lastIndex: number) => void
+ onScrollIndex(firstIndex: number, lastIndex: number) => void
- Triggered when the start position and end position of the current list are changed.
+ Triggered when the start position and end position of the current list are changed.
+
+
+ onItemDragEnter(callback: (event: ItemDragInfo ) => void)
+
+ Triggered when the list item that is bound to the drag event enters a valid drop target.
+ itemIndex : original index of the list item that is being dragged. insertIndex : index of the list item after it is dragged and inserted into the list.
+ NOTE: This event is valid only when the onDrop event is listened to.
+
+
+
+ onItemDragMove(callback: (event: ItemDragInfo , itemIndex: number, insertIndex: number) => void)
+
+
+ Triggered when the list item that is bound to the drag event enters a valid drop target.
+ itemIndex : original index of the list item that is being dragged. insertIndex : index of the list item after it is dragged and inserted into the list.
+ NOTE: This event is valid only when the onDrop event is listened to.
+
+
+
+ onItemDragLeave(callback: (event: ItemDragInfo , itemIndex: number) => void)
+
+
+ Triggered when the list item that is bound to the drag event leaves a valid drop target.
+ itemIndex : original index of the list item that is being dragged.
+ NOTE: This event is valid only when the onDrop event is listened to.
+
+
+
+ onItemDragStart(callback: (event: ItemDragInfo , itemIndex: number) => CustomBuilder )
+
+
+ Triggered when the list item that is bound to the drag event is dragged for the first time.
+ itemIndex : original index of the list item that is being dragged.Return value: floating UI layout of the list item that is being dragged.
+ NOTE: This event is valid only when the onDrop event is listened to.
+
+
+
+ onItemDrop(callback: (event: ItemDragInfo , itemIndex: number, insertIndex: number, isSuccess: boolean) => void)
+
+
+ Triggered when the list item that is bound to the drag event is dropped on a valid drop target.
+ itemIndex : original index of the list item that is being dragged. insertIndex : index of the list item after it is dragged and inserted into the list. isSuccess : whether the insertion is successful after the list item is dropped.
+ NOTE: This event is valid only when the onDrop event is listened to.
+
@@ -197,8 +221,40 @@ List\(options?: \{ space?: number, initialIndex?: number \}\)
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
>To enable the editable mode for a list, the following conditions must be met:
>- **editMode** is set to **true**.
->- The **onItemDelete** callback is bound, and the value **true** is returned.
->- The **editable** attribute of **** is set to **true**.
+>- The list is bound to the **onItemDelete** event and the event returns **true** during event callback.
+>- The **editable** attribute of **ListItem** is set to **true**.
+>To enable for a list item, the following conditions must be met:
+>- **editMode** is set to **true**.
+>- The list item is bound to the **onItemDragStart** event and the event returns a floating UI during event callback.
+
+- ItemDragInfo attributes
+
+
+ Name
+
+ Type
+
+ Description
+
+
+
+ x
+
+ number
+
+ X-coordinate of the item that is being dragged.
+
+
+ y
+
+ number
+
+ Y-coordinate of the item that is being dragged.
+
+
+
+
+
## Example
@@ -250,3 +306,121 @@ struct ListExample {
![](figures/list.gif)
+```
+@Entry
+@Component
+struct DragListExample {
+ @State number1: string[] = ['0', '1', '2']
+ @State number2: string[] = ['one', 'two', 'three']
+ @State text: string = ''
+ @State bool1: boolean = false
+ @State bool2: boolean = false
+
+ @Builder pixelMapBuilder() {
+ Text('-1')
+ .width('100%').height(100).fontSize(16)
+ .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF)
+ }
+
+ build() {
+ Column() {
+ List() {
+ ForEach(this.number1, (item) => {
+ ListItem() {
+ Text('' + item)
+ .width('100%').height(100).fontSize(16)
+ .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xF666FF)
+ }
+ }, item => item)
+ }
+ .editMode(true)
+ .width('90%').divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 })
+ .onItemDelete((index: number) => {
+ console.info(this.Number1[index] + 'Delete')
+ this.Number1.splice(index, 1)
+ console.info(JSON.stringify(this.Number1))
+ return true
+ })
+ .onItemDragStart((event: ItemDragInfo, itemIndex: number) => {
+ this.bool1 = true
+ this.text = this.number1[itemIndex]
+ console.log("List1 onItemDragStart, itemIndex:" + itemIndex + ", ItemDragInfo:"+`${JSON.stringify(event)}`)
+ return this.pixelMapBuilder
+ })
+ .onItemDragEnter((event: ItemDragInfo) => {
+ console.log("List1 onItemDragEnter")
+ })
+ .onItemDragMove((event: ItemDragInfo, itemIndex: number, insertIndex: number) => {
+ console.log("List1 onItemDragMove, itemIndex:" + itemIndex + ", insertIndex:" + insertIndex)
+ })
+ .onItemDragLeave((event: ItemDragInfo, itemIndex: number) => {
+ console.log("List1 onItemDragLeave, itemIndex:" + itemIndex)
+ })
+ .onItemDrop((event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => {
+ if (isSuccess) {
+ if (this.bool2) {
+ this.number2.splice(itemIndex, 1)
+ this.number1.splice(insertIndex, 0, this.text)
+ this.bool1 = false
+ this.bool2 = false
+ } else if (this.bool1) {
+ this.number1.splice(itemIndex, 1)
+ this.number1.splice(insertIndex, 0, this.text)
+ this.bool1 = false
+ this.bool2 = false
+ }
+ }
+ console.log("List1 onItemDrop, itemIndex:" + itemIndex + ", insertIndex:" + insertIndex + ", isSuccess:" + isSuccess)
+ })
+ Divider().strokeWidth(5).color(0x2788D9).lineCap(LineCapStyle.Round).margin(20)
+ List() {
+ ForEach(this.Number2, (item) => {
+ ListItem() {
+ Text('' + item)
+ .width('100%').height(100).fontSize(16)
+ .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFF888)
+ }
+ }, item => item)
+ }
+ .edgeEffect(EdgeEffect.None)
+ .width('90%')
+ .editMode(true)
+ .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 })
+ .onItemDragStart((event: ItemDragInfo, itemIndex: number) => {
+ this.bool2 = true
+ this.text = this.number2[itemIndex]
+ console.log("List2 onItemDragStart, itemIndex:" + itemIndex)
+ return this.pixelMapBuilder
+ })
+ .onItemDragEnter((event: ItemDragInfo) => {
+ console.log("List2 onItemDragEnter")
+ })
+ .onItemDragMove((event: ItemDragInfo, itemIndex: number, insertIndex: number) => {
+ console.log("List2 onItemDragMove, itemIndex:" + itemIndex + ", insertIndex:" + insertIndex)
+ })
+ .onItemDragLeave((event: ItemDragInfo, itemIndex: number) => {
+ console.log("List2 onItemDragLeave, itemIndex:" + itemIndex)
+ })
+ .onItemDrop((event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => {
+ if (isSuccess) {
+ if (this.bool1) {
+ this.number1.splice(itemIndex, 1)
+ this.number2.splice(insertIndex, 0, this.text)
+ this.bool1 = false
+ this.bool2 = false
+ } else if (this.bool2) {
+ this.number2.splice(itemIndex, 1)
+ this.number2.splice(insertIndex, 0, this.text)
+ this.bool1 = false
+ this.bool2 = false
+ }
+ }
+ console.log("List2 onItemDrop, itemIndex:" + itemIndex + ", insertIndex:" + insertIndex + ", isSuccess:" + isSuccess)
+ })
+ }.width('100%').height('100%').backgroundColor(0xE600000).padding({ top: 25 })
+ }
+}
+```
+
+![](figures/gif-4.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-container-listitem.md b/en/application-dev/reference/arkui-ts/ts-container-listitem.md
index fe496bf9daefc6ede5da40983a130981ed0cf162..e96b60c18f19ce2fb07cde2b64d1790fcb350c1b 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-listitem.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-listitem.md
@@ -1,4 +1,7 @@
-# ListItem
+# ListItem
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component displays specific items in the list. Its width occupies the **** component by default and must be used together with ****.
diff --git a/en/application-dev/reference/arkui-ts/ts-container-navigation.md b/en/application-dev/reference/arkui-ts/ts-container-navigation.md
new file mode 100644
index 0000000000000000000000000000000000000000..d0b68b8fbfae41d3c239ea93237214a192b4ae1a
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-container-navigation.md
@@ -0,0 +1,418 @@
+# Navigation
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+The **** component typically functions as the root container of a page and displays the page title, toolbar, and menu through attribute settings.
+
+## Required Permissions
+
+None
+
+## Child Components
+
+This component can contain child components.
+
+## APIs
+
+Navigation\(\)
+
+Creates a component that can automatically display the navigation bar, title, and toolbar based on the attribute settings.
+
+## Attributes
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+ title
+
+ string | CustomBuilder
+
+ -
+
+ No title
+
+
+ subtitle
+
+ string
+
+ -
+
+ Subtitle of the page.
+
+
+ menus
+
+ Array<NavigationMenuItem > | CustomBuilder
+
+ -
+
+ Menu in the upper right corner of the page.
+
+
+
+ titleMode
+
+NavigationTitleMode
+
+ NavigationTitleMode.Free
+
+ Display mode of the page title bar.
+
+
+ toolBar
+
+ {
+ items:[
+Object
+ ] }
+ | CustomBuilder
+
+
+ -
+
+ Content of the toolbar.
+ items : all items on the toolbar.
+
+
+ hideToolBar
+
+ boolean
+
+ false
+
+ Whether the toolbar is shown or hidden.
+ true : The toolbar is hidden.
+ false : The toolbar is shown.
+
+
+ hideTitleBar
+
+ boolean
+
+ false
+
+ Whether the title bar is hidden.
+
+
+ hideBackButton
+
+ boolean
+
+ false
+
+ Whether the back key is hidden.
+
+
+
+
+
+- NavigationMenuItem parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ value
+
+ string
+
+ Yes
+
+ -
+
+ Text of a single option on the menu bar.
+
+
+ icon
+
+ string
+
+ No
+
+ -
+
+ Icon path of a single option on the menu bar.
+
+
+ action
+
+ () => void
+
+ No
+
+ -
+
+ Callback invoked when the option is selected.
+
+
+
+
+
+
+- Object attributes
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ value
+
+ string
+
+ Yes
+
+ -
+
+ Text of a single option on the toolbar.
+
+
+ icon
+
+ string
+
+ No
+
+ -
+
+ Icon path of a single option on the toolbar.
+
+
+ action
+
+ () => void
+
+ No
+
+ -
+
+ Callback invoked when the option is selected.
+
+
+
+
+
+- NavigationTitleMode enums
+
+
+ Name
+
+ Description
+
+
+
+ Free
+
+ When the content is a scrollable component, the title shrinks as the content scrolls up (the subtitle fades out with its size remaining unchanged) and restores to the original one as the content scrolls down.
+
+
+ Mini
+
+ The mode is fixed at subtitle mode (icon + main title and subtitle).
+
+
+ Full
+
+ The mode is fixed at main title mode (main title and subtitle).
+
+
+
+
+
+ >![](../../public_sys-resources/icon-note.gif) **NOTE:**
+ >Currently, only the scrollable component **** is supported.
+
+
+## Events
+
+
+ Name
+
+ Description
+
+
+
+ onTitleModeChanged(callback: (titleMode: NavigationTitleMode) => void)
+
+ Triggered when titleMode is set to NavigationTitleMode.Free and the title bar mode changes as content scrolls.
+
+
+
+
+
+## Example
+
+```
+/ Example 01
+@Entry
+@Component
+struct NavigationExample {
+ private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+ @State hideBar: boolean = true
+
+ @Builder NavigationTitle() {
+ Column() {
+ Text('title')
+ .width(80)
+ .height(60)
+ .fontColor(Color.Blue)
+ .fontSize(30)
+ }
+ .onClick(() => {
+ console.log("title")
+ })
+ }
+
+ @Builder NavigationMenus() {
+ Row() {
+ Image('images/add.png')
+ .width(25)
+ .height(25)
+ Image('comment/more.png')
+ .width(25)
+ .height(25)
+ .margin({ left: 30 })
+ }.width(100)
+ }
+
+ build() {
+ Column() {
+ Navigation() {
+ Search({ value: '', placeholder: "" }).width('85%').margin(26)
+ List({ space: 5, initialIndex: 0 }) {
+ ForEach(this.arr, (item) => {
+ ListItem() {
+ Text('' + item)
+ .width('90%')
+ .height(80)
+ .backgroundColor('#3366CC')
+ .borderRadius(15)
+ .fontSize(16)
+ .textAlign(TextAlign.Center)
+ }.editable(true)
+ }, item => item)
+ }
+ .listDirection(Axis.Vertical)
+ .height(300)
+ .margin({ top: 10, left: 18 })
+ .width('100%')
+
+ Button(this.hideBar ? "tool bar" : "hide bar")
+ .onClick(() => {
+ this.hideBar = !this.hideBar
+ })
+ .margin({ left: 135, top: 60 })
+ }
+ .title(this.NavigationTitle)
+ .subTitle('subtitle')
+ .menus(this.NavigationMenus)
+ .titleMode(NavigationTitleMode.Free)
+ .hideTitleBar(false)
+ .hideBackButton(false)
+ .onTitleModeChanged((titleModel: NavigationTitleMode) => {
+ console.log('titleMode')
+ })
+ .toolBar({ items: [
+ { value: 'app', icon: 'images/grid.svg', action: () => {
+ console.log("app")
+ } },
+ { value: 'add', icon: 'images/add.svg', action: () => {
+ console.log("add")
+ } },
+ { value: 'collect', icon: 'images/collect.svg', action: () => {
+ console.log("collect")
+ } }] })
+ .hideToolBar(this.hideBar)
+ }
+ }
+}
+```
+
+![](figures/66666.gif)
+
+```
+// Example 02
+@Entry
+@Component
+struct ToolbarBuilderExample {
+ @State currentIndex: number = 0
+ @State Build: Array = [
+ {
+ icon: $r('app.media.ic_public_add'),
+ icon_after: $r('app.media.ic_public_addcolor'),
+ text: 'add',
+ num: 0
+ },
+ {
+ icon: $r('app.media.ic_public_app'),
+ icon_after: $r('app.media.ic_public_appcolor'),
+ text: 'app',
+ num: 1
+ },
+ {
+ icon: $r('app.media.ic_public_collect'),
+ icon_after: $r('app.media.ic_public_collectcolor'),
+ text: 'collect',
+ num: 2
+ }
+ ]
+
+ @Builder NavigationToolbar() {
+ Row() {
+ ForEach(this.Build, item => {
+ Column() {
+ Image(this.currentIndex == item.num ? item.icon_after : item.icon)
+ .width(25)
+ .height(25)
+ Text(item.text)
+ .fontColor(this.currentIndex == item.num ? "#ff7500" : "#000000")
+ }
+ .onClick(() => {
+ this.currentIndex = item.num
+ })
+ .margin({ left: 70 })
+ })
+ }
+ }
+
+ build() {
+ Column() {
+ Navigation() {
+ Flex() {
+ }
+ }
+ .toolBar(this.NavigationToolbar)
+ }
+ }
+}
+```
+
+![](figures/duande.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-container-navigator.md b/en/application-dev/reference/arkui-ts/ts-container-navigator.md
index 37711363a1a83fac38d4c498484846a3ea90ea8c..a07cec59e74a380fa348d3236dd7954bf97c7c3b 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-navigator.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-navigator.md
@@ -1,4 +1,7 @@
-# Navigator
+# Navigator
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component provides redirection.
diff --git a/en/application-dev/reference/arkui-ts/ts-container-panel.md b/en/application-dev/reference/arkui-ts/ts-container-panel.md
index 0fb4cc8f856b33ecc5af3cc09172508f61f3b227..5c32f0a4cbfb18288990478253d37b58bc0a088a 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-panel.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-panel.md
@@ -1,4 +1,7 @@
-# Panel
+# Panel
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is a slidable panel that presents lightweight content with flexible sizes. It is a pop-up component.
diff --git a/en/application-dev/reference/arkui-ts/ts-container-row.md b/en/application-dev/reference/arkui-ts/ts-container-row.md
index cb8d022684d28991ea8ea9a197b71c376140b436..e25ea9b861af2897ea301d7e6eb2d6cb5055a639 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-row.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-row.md
@@ -1,4 +1,7 @@
-# Row
+# Row
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component lays out child components horizontally.
@@ -12,7 +15,7 @@ This component can contain child components.
## APIs
-Row\(options?: \{ space?: Length \}\)
+Row\(value:\{space?: Length\}\)
- Parameters
diff --git a/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md b/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md
index 7eb38acadd6c7467406e22f3c87fdadf51e26b39..cae73207d988b6e6d6f6b82ca5b4cdadc5b0679a 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md
@@ -1,7 +1,14 @@
-# RowSplit
+# RowSplit
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** lays out child components horizontally and inserts a vertical divider between every two child components.
+## Required Permissions
+
+None
+
## Child Components
This component can contain child components.
diff --git a/en/application-dev/reference/arkui-ts/ts-container-scroll.md b/en/application-dev/reference/arkui-ts/ts-container-scroll.md
index 514239cf26b3ae87fd66fb5305a4d71915010fe0..a52e655865b7dd978c866348be8e77073d6b792f 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-scroll.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-scroll.md
@@ -1,4 +1,7 @@
-# Scroll
+# Scroll
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component scrolls the content when the layout size of a component exceeds the viewport of its parent component.
@@ -19,9 +22,9 @@ Scroll\(scroller?: Scroller\)
Name
- Type
+ Type
- Default Value
+ Default Value
Description
@@ -29,36 +32,36 @@ Scroll\(scroller?: Scroller\)
scrollable
-ScrollDirection
+ScrollDirection
- Vertical
+ Vertical
Scroll method.
scrollBar
-BarState
+BarState
- Auto
+ Auto
Scroll bar status.
scrollBarColor
- Color
+ Color
- -
+ -
Color of the scroll bar.
scrollBarWidth
- Length
+ Length
- -
+ -
Width of the scrollbar.
@@ -66,7 +69,7 @@ Scroll\(scroller?: Scroller\)
-- ScrollDirection enums
+- ScrollDirection
Name
@@ -98,7 +101,7 @@ Scroll\(scroller?: Scroller\)
Controller of the scrollable container component. You can bind this component to the container component and use it to control the scrolling of the container component. Currently, this component can be bound to the **** and **** components.
-### Objects to Import
+### Creating an Object
```
scroller: Scroller = new Scroller()
@@ -156,7 +159,8 @@ Scrolls to the specified position.
No
-
+ -
+
Animation configuration, which includes the following:
duration : scrolling duration. curve : scrolling curve.
@@ -194,7 +198,8 @@ Scrolls to the edge of the container.
-
-
+ Edge position to scroll to.
+
@@ -202,7 +207,9 @@ Scrolls to the edge of the container.
### scroller.scrollPage
-scrollPage\(value: \{ next: boolean, direction?: Axis \}\): void
+scrollPage\(value: \{ next: boolean \}\): void
+
+Scrolls to the next or previous page.
- Parameters
@@ -227,17 +234,7 @@ scrollPage\(value: \{ next: boolean, direction?: Axis \}\): void
-
- Whether to turn to the next page.
-
-
- direction
-
- Axis
-
- No
-
-
- Horizontal or vertical page flipping. If the scrolling direction of the scroll container is determined, this parameter can be omitted.
+ Whether to turn to the next page. The value true means to turn to the next page, and the value false means to turn to the previous page.
@@ -276,7 +273,7 @@ Obtains the scrolling offset.
scroller.scrollToIndex\(value: number\): void
-Scrolls to the item with the specified index.
+Scrolls to the specified index.
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
>Only the **** component is supported.
@@ -332,7 +329,7 @@ Scrolls to the item with the specified index.
onScrollEnd() => void
- Invoked when a scrolling stop event occurs.
+ Invoked when scrolling stops.
diff --git a/en/application-dev/reference/arkui-ts/ts-container-scrollbar.md b/en/application-dev/reference/arkui-ts/ts-container-scrollbar.md
new file mode 100644
index 0000000000000000000000000000000000000000..26e9012f59b576416934c0693286ba8f302285c2
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-container-scrollbar.md
@@ -0,0 +1,168 @@
+# ScrollBar
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+The **** is used together with the scrollable components, such as ****, ****, and ****.
+
+## Required Permissions
+
+None
+
+## Child Components
+
+This component can contain a single child component.
+
+## APIs
+
+ScrollBar\(value: ScrollBarOption\)
+
+- ScrollBarOption parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ scroller
+
+ Scroller
+
+ Yes
+
+ -
+
+ Scrollable component controller, which can be bound to scrollable components.
+
+
+ direction
+
+ ScrollBarDirection
+
+ No
+
+ ScrollBarDirection.Vertical
+
+ Scrollbar direction in which scrollable components scroll.
+
+
+ state
+
+ BarState
+
+ No
+
+ BarState.Auto
+
+ Scroll bar status.
+
+
+
+
+
+ >![](../../public_sys-resources/icon-note.gif) **NOTE:**
+ >The **<\ScrollBar>** component defines the behavior style of the scrollable area, and its subnodes define the behavior style of the scrollbar.
+ >This component is bound to a scrollable component through **scroller**, and can be used to scroll the scrollable component only when their directions are the same. The **<\ScrollBar>** component can be bound to only one scrollable component, and vice versa.
+
+- ScrollBarDirection enums
+
+
+ Name
+
+ Description
+
+
+
+ Vertical
+
+ Vertical scrollbar.
+
+
+ Horizontal
+
+ Horizontal scrollbar.
+
+
+
+
+
+- BarState enums
+
+
+ Name
+
+ Description
+
+
+
+ On
+
+ Always displayed.
+
+
+ Off
+
+ Hidden.
+
+
+ Auto
+
+ Displayed on demand (displayed when the user touches the screen and hidden after inactivity of 2s).
+
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct ScrollBarExample {
+ private scroller: Scroller = new Scroller()
+ private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
+
+ build() {
+ Column() {
+ Stack({ alignContent: Alignment.End }) {
+ Scroll(this.scroller) {
+ Flex({ direction: FlexDirection.Column }) {
+ ForEach(this.arr, (item) => {
+ Row() {
+ Text(item.toString())
+ .width('90%')
+ .height(100)
+ .backgroundColor('#3366CC')
+ .borderRadius(15)
+ .fontSize(16)
+ .textAlign(TextAlign.Center)
+ .margin({ top: 5 })
+ }
+ }, item => item)
+ }.margin({ left: 52 })
+ }
+ .scrollBar(BarState.Off)
+ .scrollable(ScrollDirection.Vertical)
+ ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }) {
+ Text()
+ .width(30)
+ .height(100)
+ .borderRadius(10)
+ .backgroundColor('#C0C0C0')
+ }.width(30).backgroundColor('#ededed')
+ }
+ }
+ }
+}
+```
+
+![](figures/f.gif)
diff --git a/en/application-dev/reference/arkui-ts/ts-container-stack.md b/en/application-dev/reference/arkui-ts/ts-container-stack.md
index 44eb4e2b53543c1d9c3870e31023f4089dfca306..acf2675f900b3ab96106a651887c60e30722ebdd 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-stack.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-stack.md
@@ -1,4 +1,7 @@
-# Stack
+# Stack
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component provides a stack container where child components are successively stacked and the latter one overwrites the previous one.
@@ -12,7 +15,7 @@ The **** component can contain child components.
## APIs
-Stack\(options?: \{ alignContent?: Alignment \}\)
+Stack\(value:\{alignContent?: Alignment\}\)
- Parameters
diff --git a/en/application-dev/reference/arkui-ts/ts-container-stepper.md b/en/application-dev/reference/arkui-ts/ts-container-stepper.md
new file mode 100644
index 0000000000000000000000000000000000000000..8c0d32d48378e4af273a92ceb6ae5440ebb85a18
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-container-stepper.md
@@ -0,0 +1,184 @@
+# Stepper
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+The **** component provides a step navigator.
+
+## Applicable Devices
+
+
+ Phone
+
+ Tablet
+
+ Smart TV
+
+ Wearable
+
+
+
+ Yes
+
+ Yes
+
+ No
+
+ No
+
+
+
+
+
+## Required Permissions
+
+None
+
+## Child Components
+
+Only the child component [StepperItem](ts-container-stepperitem.md) is supported.
+
+## APIs
+
+Stepper\(value?: \{ index?: number \}\)
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ index
+
+ number
+
+ No
+
+ 0
+
+ Index of the <StepperItem> child component that is currently displayed.
+
+
+
+
+
+
+## Attributes
+
+None
+
+## Events
+
+
+ Name
+
+ Description
+
+
+
+ onFinish(callback: () => void)
+
+ Triggered when the **nextLabel** of the last stepper item in the stepper is clicked.
+
+
+ onSkip(callback: () => void)
+
+ Triggered when the current stepper item is **ItemState.Skip** and the **nextLabel** is clicked.
+
+
+ onChange(callback: (prevIndex?: number, index?: number) => void)
+
+ Triggered when the text button on the left or right is clicked to switch between steps.
+**prevIndex**: index of the step page before the switching. **index**: index of the step page after the switching, that is, index of the previous or next page.
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct StepperExample {
+ @State currentIndex: number = 0
+ @State firstState: ItemState = ItemState.Normal
+ @State secondState: ItemState = ItemState.Normal
+
+ build() {
+ Stepper({
+ index: this.currentIndex
+ }) {
+ StepperItem() {
+ Text('Page One')
+ .fontSize(35)
+ .fontColor(Color.Blue)
+ .width(200)
+ .lineHeight(50)
+ .margin({top:250})
+ }
+ .nextLabel('')
+ .position({x: '35%', y: 0})
+ StepperItem() {
+ Text('Page Two')
+ .fontSize(35)
+ .fontColor(Color.Blue)
+ .width(200)
+ .lineHeight(50)
+ .margin({top:250})
+ .onClick(()=>{
+ this.firstState = this.firstState === ItemState.Skip ? ItemState.Normal : ItemState.Skip
+ })
+ }
+ .nextLabel('Next')
+ .prevLabel('Previous')
+ .status(this.firstState)
+ .position({x: '35%', y: 0})
+ StepperItem() {
+ Text('Page Three')
+ .fontSize(35)
+ .fontColor(Color.Blue)
+ .width(200)
+ .lineHeight(50)
+ .margin({top:250})
+ .onClick(()=>{
+ this.secondState = this.secondState === ItemState.Waiting ? ItemState.Normal : ItemState.Waiting
+ })
+ }
+ .position({x: '35%', y: 0})
+ .status(this.secondState)
+ StepperItem() {
+ Text('Page four')
+ .fontSize(35)
+ .fontColor(Color.Blue)
+ .width(200)
+ .lineHeight(50)
+ .margin({top:250})
+ }
+ .position({x: '35%', y: 0})
+ .nextLabel('Finish')
+ }
+ .onFinish(() => {
+ console.log('onFinish')
+ })
+ .onSkip(() => {
+ console.log('onSkip')
+ })
+ .onChange((prevIndex: number, index: number) => {
+ this.currentIndex = index
+ })
+ .align(Alignment.Center)
+ }
+}
+```
+
+![](figures/en-us_image_0000001239788885.gif)
diff --git a/en/application-dev/reference/arkui-ts/ts-container-stepperitem.md b/en/application-dev/reference/arkui-ts/ts-container-stepperitem.md
new file mode 100644
index 0000000000000000000000000000000000000000..e1c5f2bf87486c461a1273c0f045dfde4a3b2785
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-container-stepperitem.md
@@ -0,0 +1,123 @@
+# StepperItem
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+The **** component provides an element for the **** component.
+
+## Applicable Devices
+
+
+ Phone
+
+ Tablet
+
+ Smart TV
+
+ Wearable
+
+
+
+ Yes
+
+ Yes
+
+ No
+
+ No
+
+
+
+
+
+## Required Permissions
+
+None
+
+## Child Components
+
+This component supports only one child component.
+
+## APIs
+
+StepperItem\(\)
+
+## Attributes
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+ prevLabel
+
+ string
+
+ -
+
+ When the stepper contains more than one page, the default value for all pages except the first page is **Back**.
+
+
+ nextLabel
+
+ string
+
+ -
+
+If the When the stepper contains more than one page, the default value for the last page is **Start**, and the default value for other pages is **Next**.
+
+
+ status
+
+ItemState
+
+ ItemState.Normal
+
+ Status of the stepper item.
+
+
+
+
+
+- ItemState enums
+
+
+ Name
+
+ Description
+
+
+
+ Normal
+
+ Normal state, in which the text button on the right is displayed properly and can be clicked to go to the next stepper item.
+
+
+ Disabled
+
+ Disabled state, in which the text button on the right is dimmed and cannot be clicked to go to the next stepper item.
+
+
+ Waiting
+
+ Waiting state, in which a waiting progress bar instead of the text button on the right is displayed. The progress bar cannot be clicked to go to the next stepper item.
+
+
+ Skip
+
+ Skipped state, in which the current step item is skipped and the next step item is performed.
+
+
+
+
+
+
+## Example
+
+See [Stepper](ts-container-stepper.md).
diff --git a/en/application-dev/reference/arkui-ts/ts-container-swiper.md b/en/application-dev/reference/arkui-ts/ts-container-swiper.md
index 3f16f010ee5c5e8c18501ed12d01056bfb998c82..fea72e9b71f19f6ccf857016ecbe98d5a9c2a9d7 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-swiper.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-swiper.md
@@ -1,4 +1,7 @@
-# Swiper
+# Swiper
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component provides a container that allows users to switch among child components by swiping operations.
@@ -47,9 +50,9 @@ Swiper\(value:\{controller?: SwiperController\}\)
## Attributes
- Name
+ Name
- Type
+ Type
Default Value
@@ -57,78 +60,96 @@ Swiper\(value:\{controller?: SwiperController\}\)
- index
+ index
- number
+ number
0
Index of the child component currently displayed in the container.
- autoPlay
+ autoPlay
- boolean
+ boolean
false
Whether to enable automatic playback for child component switching. If this attribute is true , the indicator dots do not take effect.
- interval
+ interval
- number
+ number
3000
Interval for automatic playback, in ms.
- indicator
+ indicator
- boolean
+ boolean
true
Whether to enable the navigation dots.
- loop
+ loop
- boolean
+ boolean
true
Whether to enable loop playback.
- duration
+ duration
- number
+ number
400
Duration of the animation for switching child components, in ms.
- vertical
+ vertical
- boolean
+ boolean
false
Whether vertical swiping is used.
- itemSpace
+ itemSpace
- Length
+ Length
0
Space between child components.
+ cachedCount 8+
+
+ number
+
+ 1
+
+ Number of child components to be cached.
+
+
+ disableSwipe 8+
+
+ boolean
+
+ false
+
+ Whether to disable the swipe feature.
+
+
@@ -176,20 +197,52 @@ Controller of the **** component. You can bind this object to the **
## Example
```
+class MyDataSource implements IDataSource {
+ private list: number[] = []
+ private listener: DataChangeListener
+
+ constructor(list: number[]) {
+ this.list = list
+ }
+
+ totalCount(): number {
+ return this.list.length
+ }
+
+ getData(index: number): any {
+ return this.list[index]
+ }
+
+ registerDataChangeListener(listener: DataChangeListener): void {
+ this.listener = listener
+ }
+
+ unregisterDataChangeListener() {
+ }
+}
+
@Entry
@Component
struct SwiperExample {
private swiperController: SwiperController = new SwiperController()
+ private data: MyDataSource = new MyDataSource([])
+
+ private aboutToAppear(): void {
+ let list = []
+ for (var i = 1; i <= 10; i++) {
+ list.push(i.toString());
+ }
+ this.data = new MyDataSource(list)
+ }
build() {
Column({ space: 5 }) {
Swiper(this.swiperController) {
- Text('1').width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(20)
- Text('2').width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(20)
- Text('3').width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(20)
- Text('4').width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(20)
- Text('5').width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(20)
+ LazyForEach(this.data, (item: string) => {
+ Text(item).width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(20)
+ }, item => item)
}
+ .cachedCount(2)
.index(1)
.autoPlay(true)
.interval(4000)
diff --git a/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md b/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md
index b5594d313ab3123ba2e449806a6184ffb3f6b8dc..0d18789c72139ba1d65d2ffe2a7aab970d188168 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md
@@ -1,4 +1,7 @@
-# TabContent
+# TabContent
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used only in the **** component. It corresponds to the content view of a switched tab page.
@@ -16,6 +19,8 @@ TabContent\(\)
## Attributes
+Touch target configuration is not supported.
+
Name
@@ -32,11 +37,13 @@ TabContent\(\)
string | {
icon?: string,
text?: string
- }
+ }
+ | CustomBuilder 8+
-
Content displayed on the tab bar.
+ CustomBuilder: builder, which can be passed to components (applicable to API 8 or later versions).
NOTE: If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image.
@@ -50,5 +57,123 @@ TabContent\(\)
## Example
-See [Tabs](ts-container-tabs.md#section1131255321814).
+```
+@Entry
+@Component
+struct TabContentExample {
+ @State fontColor: string = 'rgba(0, 0, 0, 0.4)'
+ @State selectedFontColor: string = 'rgba(10, 30, 255, 1)'
+ @State currentIndex: number = 0
+ private controller: TabsController = new TabsController()
+ @Builder Tab1Builder() {
+ Column() {
+ Image(this.currentIndex === 0 ? '/resources/ic_public_contacts_filled_selected.png' : '/resources/ic_public_contacts_filled.png')
+ .width(24)
+ .height(24)
+ .opacity(this.currentIndex === 0 ? 1 : 0.4)
+ .objectFit(ImageFit.Contain)
+ Text("Tab1")
+ .fontColor(this.currentIndex === 0 ? this.selectedFontColor : this.fontColor)
+ .fontSize(10)
+ .margin({top: 2})
+ }
+ }
+
+ @Builder Tab2Builder() {
+ Column() {
+ Image(this.currentIndex === 1 ? '/resources/ic_public_contacts_filled_selected.png' : '/resources/ic_public_contacts_filled.png')
+ .width(24)
+ .height(24)
+ .opacity(this.currentIndex === 1 ? 1 : 0.4)
+ .objectFit(ImageFit.Contain)
+ Text("Tab2")
+ .fontColor(this.currentIndex === 1 ? this.selectedFontColor : this.fontColor)
+ .fontSize(10)
+ .margin({top: 2})
+ }
+ }
+
+ @Builder Tab3Builder() {
+ Column() {
+ Image(this.currentIndex === 3 ? '/resources/ic_public_contacts_filled_selected.png' : '/resources/ic_public_contacts_filled.png')
+ .width(24)
+ .height(24)
+ .opacity(this.currentIndex === 3 ? 1 : 0.4)
+ .objectFit(ImageFit.Contain)
+ Text("Tab3")
+ .fontColor(this.currentIndex === 3 ? this.selectedFontColor : this.fontColor)
+ .fontSize(10)
+ .margin({top: 2})
+ }
+ }
+
+ @Builder Tab4Builder() {
+ Column() {
+ Image(this.currentIndex === 4 ? '/resources/ic_public_contacts_filled_selected.png' : '/resources/ic_public_contacts_filled.png')
+ .width(24)
+ .height(24)
+ .opacity(this.currentIndex === 4 ? 1 : 0.4)
+ .objectFit(ImageFit.Contain)
+ Text("Tab4")
+ .fontColor(this.currentIndex === 4 ? this.selectedFontColor : this.fontColor)
+ .fontSize(10)
+ .margin({top: 2})
+ }
+ }
+
+ @Builder AddBuilder() {
+ Column() {
+ Image(this.currentIndex === 2 ? '/resources/ic_public_add_norm_filled_selected.png' : '/resources/ic_public_add_norm_filled.png')
+ .width(this.currentIndex === 2 ? 26 : 24)
+ .height(this.currentIndex === 2 ? 26 : 24)
+ .opacity(this.currentIndex === 2 ? 1 : 0.4)
+ .objectFit(ImageFit.Contain)
+ .animation({duration: 200})
+ }
+ }
+
+ build() {
+ Column() {
+ Tabs({ barPosition: BarPosition.End, index: 0, controller: this.controller }) {
+ TabContent() {
+ Flex({justifyContent: FlexAlign.Center})) {
+ Text('Tab1').fontSize(32)
+ }
+ }.tabBar(this.Tab1Builder)
+
+ TabContent() {
+ Flex({justifyContent: FlexAlign.Center})) {
+ Text('Tab2').fontSize(32)
+ }
+ }.tabBar(this.Tab2Builder)
+
+ TabContent() {
+ Flex({justifyContent: FlexAlign.Center})) {
+ Text('Add').fontSize(32)
+ }
+ }.tabBar(this.AddBuilder)
+
+ TabContent() {
+ Flex({justifyContent: FlexAlign.Center})) {
+ Text('Tab3').fontSize(32)
+ }
+ }.tabBar(this.Tab3Builder)
+
+ TabContent() {
+ Flex({justifyContent: FlexAlign.Center})) {
+ Text('Tab4').fontSize(32)
+ }
+ }.tabBar(this.Tab4Builder)
+ }
+ .vertical(false)
+ .barWidth(300).barHeight(56)
+ .onChange((index: number) => {
+ this.currentIndex = index
+ })
+ .width('90%').backgroundColor('rgba(241, 243, 245, 0.95)')
+ }.width('100%').height(200).margin({ top: 5 })
+ }
+}
+```
+![](figures/en-us_image_0000001193075122.gif)
diff --git a/en/application-dev/reference/arkui-ts/ts-container-tabs.md b/en/application-dev/reference/arkui-ts/ts-container-tabs.md
index 450b6211d55f9e0914a1ac31219222b0dc9392c4..e6c394df300683312e582d6d63acf20d9263ace6 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-tabs.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-tabs.md
@@ -1,4 +1,7 @@
-# Tabs
+# Tabs
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is a container component that allows users to switch between content views through tabs. Each tab page corresponds to a content view.
@@ -133,6 +136,8 @@ Defines a tab controller, which is used to control switching of tabs.
## Attributes
+Touch target configuration is not supported.
+
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-declarative-syntax.md b/en/application-dev/reference/arkui-ts/ts-declarative-syntax.md
deleted file mode 100644
index 65f722e1edadbc670d1f6ef42330f1587714656c..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/arkui-ts/ts-declarative-syntax.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# Declarative Syntax
-
-- **[Overview](ts-syntax-intro.md)**
-
-- **[General UI Description Specifications](ts-general-ui-description-specifications.md)**
-
-- **[UI State Management](ts-ui-state-management.md)**
-
-- **[Rendering Control Syntax](ts-rending-control-syntax.md)**
-
-- **[A Deep Dive into @Component](ts-a-deep-dive-into-component.md)**
-
-- **[Syntactic Sugar](ts-syntactic-sugar.md)**
-
-
diff --git a/en/application-dev/reference/arkui-ts/ts-declarative.md b/en/application-dev/reference/arkui-ts/ts-declarative.md
deleted file mode 100644
index 0b6692ce02417e12633229e6f0e20fdd026a580b..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/arkui-ts/ts-declarative.md
+++ /dev/null
@@ -1,15 +0,0 @@
-# TypeScript-based Declarative Development Paradigm
-
-- **[Framework Overview](ts-framework-framework.md)**
-
-- **[Declarative Syntax](ts-declarative-syntax.md)**
-
-- **[Components](ts-components.md)**
-
-- **[Animation](ts-animation.md)**
-
-- **[Global UI Methods](ts-global-ui-methods.md)**
-
-- **[Appendix](ts-appendix.md)**
-
-
diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md
index aea3b4fddd5a3bea925af852a04237756f85c8b8..787ebf3396fa7e90eb19ae277d9cbe2649cd0c35 100644
--- a/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md
+++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md
@@ -1,7 +1,14 @@
-# Circle
+# Circle
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to draw a circle.
+## Required Permissions
+
+None
+
## Child Components
None
diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md
index c5f2d174752f660e81199acc49ba9650550912e0..d36939e06bb7df2bdaf1de30e5f56dad58854707 100644
--- a/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md
+++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md
@@ -1,14 +1,21 @@
-# Ellipse
+# Ellipse
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to draw an ellipse.
+## Required Permissions
+
+None
+
## Child Components
None
## APIs
-ellipse\(options?: \{width: Length, height: Length\}\)
+ellipse\(options?: \{width: Lenght, height: Length\}\)
- Parameters
@@ -137,5 +144,5 @@ struct EllipseExample {
}
```
-![](figures/ellipse-63.png)
+![](figures/ellipse.png)
diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md
index 03fae2dad61dced71ac488f8fe77bc44b39de2ca..00cb05366364d11d4205c94a97f2892c02b73f79 100644
--- a/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md
+++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md
@@ -1,14 +1,21 @@
-# Line
+# Line
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to draw a straight line.
+## Required Permissions
+
+None
+
## Child Components
None
## APIs
-Line\(options?: \{width: Length, height: Length\}\)
+Line\(options?: \{width: Lenght, height: Length\}\)
- Parameters
diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md
index cb4c399e35cab476c14ab3dc3b6e8b5181293d39..3642fd8e7671af6638975d85536c7070cfc824d9 100644
--- a/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md
+++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md
@@ -1,7 +1,14 @@
-# Path
+# Path
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to draw a path.
+## Required Permissions
+
+None
+
## Child Components
None
diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md
index d7a5b0cd53a8bf5eaf304b8ed6e17ec0ecb1b0ef..c1eec93f59e1b14d8e61df5e377211b2327a778d 100644
--- a/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md
+++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md
@@ -1,14 +1,21 @@
-# Polygon
+# Polygon
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to draw a polygon.
+## Required Permissions
+
+None
+
## Child Components
None
## APIs
-Polygon\(value:\{options?: \{width: Length, height: Length\}\}\)
+Polygon\(value:\{options?: \{width: Lenght, height: Length\}\}\)
- Parameters
diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md
index 1f0a60df04624328888b1f14693f1132c5fdaadf..d09da452bc117cb8041936f6c0d43278566a8155 100644
--- a/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md
+++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md
@@ -1,14 +1,21 @@
-# Polyline
+# Polyline
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to draw a polyline.
+## Required Permissions
+
+None
+
## Child Components
None
## APIs
-Polyline\(options?: \{width: Length, height: Length\}\)
+Polyline\(options?: \{width: Lenght, height: Length\}\)
- Parameters
diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md
index 64aee72ab59f9b8a72fa3d57ffc2b58dcaec5eb1..7a85738af04b856668d48b98baf6be2443378e92 100644
--- a/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md
+++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md
@@ -1,7 +1,14 @@
-# Rect
+# Rect
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is used to draw a rectangle.
+## Required Permissions
+
+None
+
## Child Components
None
diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md
index a9de31541ab38c3be44d6ffac6a621066e27ef61..18ac993b3063e380357782c72ffceb34d41eceff 100644
--- a/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md
+++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md
@@ -1,4 +1,7 @@
-# Shape
+# Shape
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **** component is the parent component of the drawing components. The attributes described in this topic are universal attributes supported by all the drawing components.
@@ -6,13 +9,17 @@ The **** component is the parent component of the drawing components.
2. The **** component is used independently to draw a specific shape.
+## Required Permissions
+
+None
+
## Child Components
The **** component can contain child components.
## APIs
-Shape\(target?: PixelMap\)
+Shape\(value:\{target?: PixelMap\}\)
- Parameters
@@ -224,7 +231,7 @@ Shape\(target?: PixelMap\)
struct ShapeExample {
build() {
Column({ space: 5 }) {
- Text('basic').fontSize(9).fontColor(0xCCCCCC).width(320)
+ Text('basic').fontSize(30).fontColor(0xCCCCCC).width(320)
// Draw a 300 x 50 rectangle with strokes at (-2, -2). The fill color is 0x317Af7, the stroke color is black, the stroke width is 4, the stroke dash is 20, the offset is 10 to the left, the cap style is rounded, the join style is rounded, and anti-aliasing is enabled (default).
// Draw a 300 x 50 ellipse with strokes at (-2, 58). The fill color is 0x317Af7, the stroke color is black, the stroke width is 4, the stroke dash is 20, the offset is 10 to the left, the cap style is rounded, the join style is rounded, and anti-aliasing is enabled (default).
// Draw a 300 x 10 path at (-2, 118). The fill color is 0x317Af7, the stroke color is black, the stroke width is 4, the stroke dash is 20, the offset is 10 to the left, the cap style is rounded, and the join style is rounded, and anti-aliasing is enabled (default).
@@ -233,7 +240,7 @@ struct ShapeExample {
Ellipse().width(300).height(50).offset({ x: 0, y: 60 })
Path().width(300).height(10).commands('M0 0 L900 0').offset({ x: 0, y: 120 })
}
- .viewPort({ x: -2, y: -2, width: 304, height: 124 })
+ .viewPort({ x: -2, y: -2, width: 304, height: 130 })
.fill(0x317Af7).stroke(Color.Black).strokeWidth(4)
.strokeDashArray([20]).strokeDashOffset(10).strokeLineCap(LineCapStyle.Round)
.strokeLineJoin(LineJoinStyle.Round).antiAlias(true)
@@ -242,32 +249,32 @@ struct ShapeExample {
Rect().width(300).height(50)
}.viewPort({ x: -1, y: -1, width: 302, height: 52 }).fill(0x317Af7).stroke(Color.Black).strokeWidth(2)
- Text('border').fontSize(9).fontColor(0xCCCCCC).width(320)
+ Text('border').fontSize(30).fontColor(0xCCCCCC).width(320).margin({top:30})
// Draw a 300 x 10 path at (0, -5). The color is 0xEE8443, the stroke width is 10, and the stroke gap is 20.
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
- }.viewPort({ x: 0, y: -5, width: 300, height: 10 }).stroke(0xEE8443).strokeWidth(10).strokeDashArray([20])
+ }.viewPort({ x: 0, y: -5, width: 300, height: 20 }).stroke(0xEE8443).strokeWidth(10).strokeDashArray([20])
// Draw a 300 x 10 path at (0, -5). The fill color is 0xEE8443, the stroke width is 10, the stroke gap is 20, and the offset is 10 to the left.
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}
- .viewPort({ x: 0, y: -5, width: 300, height: 10 })
+ .viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443).strokeWidth(10).strokeDashArray([20]).strokeDashOffset(10)
// Draw a 300 x 10 path at (0, -5). The fill color is 0xEE8443, the stroke width is 10, and the stroke opacity is 0.5.
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
- }.viewPort({ x: 0, y: -5, width: 300, height: 10 }).stroke(0xEE8443).strokeWidth(10).strokeOpacity(0.5)
+ }.viewPort({ x: 0, y: -5, width: 300, height: 20 }).stroke(0xEE8443).strokeWidth(10).strokeOpacity(0.5)
// Draw a 300 x 10 path at (0, -5). The fill color is 0xEE8443, the stroke width is 10, the stroke dash is 20, the offset is 10 to the left, and the cap style is rounded.
Shape() {
Path().width(300).height(10).commands('M0 0 L900 0')
}
- .viewPort({ x: 0, y: -5, width: 300, height: 10 })
+ .viewPort({ x: 0, y: -5, width: 300, height: 20 })
.stroke(0xEE8443).strokeWidth(10).strokeDashArray([20]).strokeLineCap(LineCapStyle.Round)
// Draw a 300 x 50 rectangle with strokes at (-5, -5). The fill color is 0x317Af7, the stroke width is 10, the stroke color is 0xEE8443, and the join style is rounded.
Shape() {
- Rect().width(300).height(50)
+ Rect().width(300).height(100)
}
- .viewPort({ x: -5, y: -5, width: 310, height: 60 })
+ .viewPort({ x: -5, y: -5, width: 310, height: 120 })
.fill(0x317Af7).stroke(0xEE8443).strokeWidth(10).strokeLineJoin(LineJoinStyle.Round)
Shape() {
Path().width(300).height(60).commands('M0 0 L400 0 L400 200 Z')
@@ -280,5 +287,5 @@ struct ShapeExample {
}
```
-![](figures/shape.gif)
+![](figures/2-01.png)
diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components.md b/en/application-dev/reference/arkui-ts/ts-drawing-components.md
index 4a02c72060975db39b2142f84b7c95d0901cad87..1f1eeac321fc01c4e0024b115b97584fc6dc1c39 100644
--- a/en/application-dev/reference/arkui-ts/ts-drawing-components.md
+++ b/en/application-dev/reference/arkui-ts/ts-drawing-components.md
@@ -1,4 +1,4 @@
-# Drawing Components
+# Drawing Components
- **[Circle](ts-drawing-components-circle.md)**
diff --git a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md
index 9b93c9cffd76ac518ab281a3f50671c68cb6592d..af5ab03d553bae49373b8c023c8d25855ff31da8 100644
--- a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md
+++ b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md
@@ -1,4 +1,7 @@
-# Explicit Animation
+# Explicit Animation
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-gesture-processing.md b/en/application-dev/reference/arkui-ts/ts-gesture-processing.md
index 2e9679997a14217c8c9cd6e866a06f5eac29f6a9..cd8880a63e51c155ee5a9f4b3945fa843d127cd1 100644
--- a/en/application-dev/reference/arkui-ts/ts-gesture-processing.md
+++ b/en/application-dev/reference/arkui-ts/ts-gesture-processing.md
@@ -1,4 +1,4 @@
-# Gesture Processing
+# Gesture Processing
- **[Gesture Binding Methods](ts-gesture-settings.md)**
diff --git a/en/application-dev/reference/arkui-ts/ts-gesture-settings.md b/en/application-dev/reference/arkui-ts/ts-gesture-settings.md
index 8e932fa5193c87c8057c0a114fa0f519a8e3022d..40503a4845c5fbbf44d9017ae8d58489e1a7c90f 100644
--- a/en/application-dev/reference/arkui-ts/ts-gesture-settings.md
+++ b/en/application-dev/reference/arkui-ts/ts-gesture-settings.md
@@ -1,4 +1,13 @@
-# Gesture Binding Methods
+# Gesture Binding Methods
+
+>![](../../public_sys-resources/icon-note.gif) **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.
+
+## Required Permissions
+
+None
+
+## Binding Gesture Recognition
You can use the following attributes to bind gesture recognition to a component. When a gesture is recognized, the event callback is invoked to notify the component.
@@ -73,7 +82,7 @@ You can use the following attributes to bind gesture recognition to a component.
IgnoreInternal
The gestures of child components are masked. Only the gestures of the current component are recognized.
- NOTE: However, the built-in gestures of the child components are not masked. For example, when the child component is a <List> component, the built-in sliding gestures can still be triggered.
+
NOTE: However, the built-in gestures of the child components are not masked. For example, when the child component is a <List> component, the built-in sliding gestures can still be triggered.
@@ -149,68 +158,26 @@ The component uses the **gesture** method to bind the gesture object and uses
- GestureEvent attributes
- Name
+ Name
- Type
+ Type
Description
- repeat
-
- boolean
-
- Whether an event is repeatedly triggered. This attribute is used for the long press gesture.
-
-
- offsetX
-
- number
-
- Gesture event offset along the x-axis, in vp. This attribute is used for the pan gesture.
-
-
- offsetY
-
- number
-
- Gesture event offset along the y-axis, in vp. This attribute is used for the pan gesture.
-
-
- scale
-
- number
-
- Scale ratio. This attribute is used for the pinch gesture.
-
-
- pinchCenterX
-
- number
+ timestamp
- X-coordinate of the center point of the pinch gesture, in px. This attribute is used for the pinch gesture.
-
-
- pinchCenterY
+ number
- number
-
- Y-coordinate of the center point of the pinch gesture, in px. This attribute is used for the pinch gesture.
-
-
- angle
-
- number
-
- Rotation angle. This attribute is used for the rotation gesture.
+ Timestamp of the event.
- timestamp
+ target 8+
- number
+ EventTarget
- Timestamp of the event.
+ Object that triggers the gesture event.
@@ -226,22 +193,28 @@ struct GestureSettingsExample {
@State value: string = ''
build() {
- Column() {
- Text('Click\n' + this.value).gesture(TapGesture()
- .onAction(() => {
- this.value = 'gesture onAction'
- }))
- }.height(200).width(300).padding(60).border({ width: 1 }).margin(30)
+ Column(){
+ Column() {
+ Text('Click\n' + this.value)
+ .gesture(
+ TapGesture()
+ .onAction(() => {
+ this.value = 'gesture onAction'
+ }))
+ }.height(200).width(300).padding(60).border({ width: 1 })
// When priorityGesture is specified, the bound gesture is preferentially recognized and the child component gesture is ignored.
- .priorityGesture(
+ .priorityGesture(
TapGesture()
- .onAction(() => {
- this.value = 'priorityGesture onAction'
+ .onAction((event: GestureEvent) => {
+this.value = 'priorityGesture onAction' + '\ncomponent globalPos: ('
+ + event.target.area.globalPos.x + ',' + event.target.area.globalPos.y + ')\nwidth:'
+ + event.target.area.width + '\nheight:' + event.target.area.height
}), GestureMask.IgnoreInternal
- )
+ )
+ }.padding(60)
}
}
```
-![](figures/gesturesetting.gif)
+![](figures/en-us_image_0000001237475107.gif)
diff --git a/en/application-dev/reference/arkui-ts/ts-global-ui-methods.md b/en/application-dev/reference/arkui-ts/ts-global-ui-methods.md
index 6233ee97a0d00606d17e12c43f9b0c210b9fb75e..7bcfd801bfc0c25f3298744af98ea48c9b8f08cb 100644
--- a/en/application-dev/reference/arkui-ts/ts-global-ui-methods.md
+++ b/en/application-dev/reference/arkui-ts/ts-global-ui-methods.md
@@ -1,4 +1,4 @@
-# Global UI Methods
+# Global UI Methods
- **[Alert Dialog Box](ts-methods-alert-dialog-box.md)**
@@ -8,4 +8,6 @@
- **[Media Query](ts-methods-media-query.md)**
+- **[List Selection Dialog Box](ts-methods-custom-actionsheet.md)**
+
diff --git a/en/application-dev/reference/arkui-ts/ts-interpolation-calculation.md b/en/application-dev/reference/arkui-ts/ts-interpolation-calculation.md
index 840b6fb7820817d3ecc60e6ec6e043b951958c2a..c4e369acb641c891c4440217e55aedfd6909f0c7 100644
--- a/en/application-dev/reference/arkui-ts/ts-interpolation-calculation.md
+++ b/en/application-dev/reference/arkui-ts/ts-interpolation-calculation.md
@@ -1,4 +1,7 @@
-# Interpolation Calculation
+# Interpolation Calculation
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -292,5 +295,5 @@ struct ImageComponent {
}
```
-![](figures/5-65.gif)
+![](figures/5.gif)
diff --git a/en/application-dev/reference/arkui-ts/ts-matrix-transformation.md b/en/application-dev/reference/arkui-ts/ts-matrix-transformation.md
index dc0a6f47877cf3b7acc396c4a0a4cccf895bd430..77a42705ada3f14e5643a702156db3fb87afa7a2 100644
--- a/en/application-dev/reference/arkui-ts/ts-matrix-transformation.md
+++ b/en/application-dev/reference/arkui-ts/ts-matrix-transformation.md
@@ -1,4 +1,7 @@
-# Matrix Transformation
+# Matrix Transformation
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -775,7 +778,7 @@ Matrix rotation function, which is used to add the rotation effect to the x, y,
}
```
- ![](figures/1-64.png)
+ ![](figures/1.png)
### transformPoint
diff --git a/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md b/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md
index ba0d1786b4d2b65b715ec02ce80bcb4e052e4b4f..b5ce18d87c65bd9e182c7e127cfce6b653778d9a 100644
--- a/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md
+++ b/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md
@@ -1,4 +1,7 @@
-# Alert Dialog Box
+# Alert Dialog Box
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
You can set the text content and response callback for an alert dialog box.
@@ -30,110 +33,110 @@ You can set the text content and response callback for an alert dialog box.
- paramObject1 parameters
- Name
+ Name
- Type
+ Type
- Mandatory
+ Mandatory
- Default Value
+ Default Value
Description
- title
+ title
- string | Resource
+ string | Resource
- No
+ No
- -
+ -
Title of a dialog box.
- message
+ message
- string | Resource
+ string | Resource
- Yes
+ Yes
- -
+ -
Content of the dialog box.
- autoCancel
+ autoCancel
- boolean
+ boolean
- No
+ No
- true
+ true
Whether to close the dialog box when the overlay is clicked.
- confirm
+ confirm
- {
+ {
value: string | Resource,
fontColor?: Color | number | string | Resource,
backgroundColor?: Color | number | string | Resource,
action: () => void
}
- No
+ No
- -
+ -
Text content, text color, background color, and click callback of the confirm button.
- cancel
+ cancel
- () => void
+ () => void
- No
+ No
- -
+ -
Callback invoked when the dialog box is closed after the overlay is clicked.
- alignment
+ alignment
- DialogAlignment
+ DialogAlignment
- No
+ No
- DialogAlignment .Default
+ DialogAlignment .Default
Alignment mode of the dialog box in the vertical direction.
- offset
+ offset
- {
+ {
dx: Length | Resource,
dy: Length | Resource
}
- No
+ No
- -
+ -
Offset of the dialog box relative to the alignment position.
- gridCount
+ gridCount
- number
+ number
- No
+ No
- -
+ -
Number of grid columns occupied by the width of the dialog box.
diff --git a/en/application-dev/reference/arkui-ts/ts-methods-custom-actionsheet.md b/en/application-dev/reference/arkui-ts/ts-methods-custom-actionsheet.md
new file mode 100644
index 0000000000000000000000000000000000000000..cce4ea2419a5062a6139d714c5e7c74e8f606bf0
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-methods-custom-actionsheet.md
@@ -0,0 +1,235 @@
+# List Selection Dialog Box
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+List pop-up window.
+
+## Required Permissions
+
+None
+
+## ActionSheet.show
+
+show\(options: \{ [paramObject1](#table816913216616)\}\)
+
+Defines and shows the list popup window.
+
+- paramObject1 parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ title
+
+ string
+
+ No
+
+ None
+
+ Title of the dialog box.
+
+
+ message
+
+ string
+
+ Yes
+
+ -
+
+ Content of the dialog box.
+
+
+ autoCancel
+
+ boolean
+
+ No
+
+ true
+
+ Whether to close the dialog box when the overlay is clicked.
+
+
+ confirm
+
+ {
+ value: string,
+ action: () => void
+ }
+
+ No
+
+ -
+
+ Text content of the confirm button and callback upon button clicking.
+ value : button text.
+ action : callback upon button clicking.
+
+
+ cancel
+
+ () => void
+
+ No
+
+ -
+
+ Callback invoked when the dialog box is closed after the overlay is clicked.
+
+
+ alignment
+
+ DialogAlignment
+
+ No
+
+ DialogAlignment.Default
+
+ Alignment mode of the dialog box in the vertical direction.
+
+
+ offset
+
+ {
+ dx: Length,
+ dy: Length
+ }
+
+ No
+
+ {
+ dx: 0,
+ dy: 0
+ }
+
+ Offset of the dialog box relative to the alignment position.
+
+
+ sheets
+
+ Array<SheetInfo >
+
+ Yes
+
+ -
+
+ Options in the dialog box. Each option supports the image, text, and callback.
+
+
+
+
+
+- SheetInfo parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ title
+
+ string
+
+ Yes
+
+ -
+
+ Sheet text.
+
+
+ icon
+
+ string
+
+ No
+
+ None
+
+ Sheet icon.
+
+
+ action
+
+ ()=>void
+
+ Yes
+
+ -
+
+ Callback when the sheet is selected.
+
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct ActionSheetExapmle {
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Button('Click to Show ActionSheet')
+ .onClick(() => {
+ ActionSheet.show({
+ title: 'ActionSheet title',
+ message: 'message',
+ confirm: {
+ value: 'Confirm button',
+ action: () => {
+ console.log('Get Alert Dialog handled')
+ }
+ },
+ sheets: [
+ {
+ title: 'apples',
+ action: () => {
+ console.error('apples')
+ }
+ },
+ {
+ title: 'bananas',
+ action: () => {
+ console.error('bananas')
+ }
+ },
+ {
+ title: 'pears',
+ action: () => {
+ console.error('pears')
+ }
+ }
+ ]
+ })
+ })
+ }.width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001201475612.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md b/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md
index 856f5f6262cde424712bb05c77eeccde6359eaab..67e355e76b1b4e501a3c197ef270026f78ee4203 100644
--- a/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md
+++ b/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md
@@ -1,4 +1,7 @@
-# Custom Dialog box
+# Custom Dialog box
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **CustomDialogController** class is used to display a custom dialog box.
@@ -23,7 +26,7 @@ CustomDialogController\(value:\{builder: CustomDialog, cancel?: \(\) =\> void, a
builder
- CustomDialog
+ CustomDialog
Yes
diff --git a/en/application-dev/reference/arkui-ts/ts-methods-image-cache.md b/en/application-dev/reference/arkui-ts/ts-methods-image-cache.md
index f9d698bf1d4224ee26afd8248218f6f578aa6a41..3075ad66711d30b7768ee95bf8d1357f6e45dbb4 100644
--- a/en/application-dev/reference/arkui-ts/ts-methods-image-cache.md
+++ b/en/application-dev/reference/arkui-ts/ts-methods-image-cache.md
@@ -1,4 +1,7 @@
-# Image Cache
+# Image Cache
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -46,7 +49,6 @@ Sets the maximum number of decoded images that can be cached in the memory to sp
```
// app.ets
import app from '@system.app';
-
export default {
onCreate() {
app.setImageCacheCount(100) // Set the maximum number of decoded images that can be cached in the memory to 100.
diff --git a/en/application-dev/reference/arkui-ts/ts-methods-media-query.md b/en/application-dev/reference/arkui-ts/ts-methods-media-query.md
index d46cb26c2f6c4b70aa90b6d9df1ec157d7cd6f9d..8437e78f0b688355c630b49033b42ceee5d390e0 100644
--- a/en/application-dev/reference/arkui-ts/ts-methods-media-query.md
+++ b/en/application-dev/reference/arkui-ts/ts-methods-media-query.md
@@ -1,4 +1,7 @@
-# Media Query
+# Media Query
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This method is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -130,7 +133,7 @@ Registers a callback with the corresponding query condition by using the handle.
type
- boolean
+ string
Yes
diff --git a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md
index c555f30713cd69efb5620d89c22d4dd372c9a82d..56719de12b1bc36a1ebaf620d57898336dae0618 100644
--- a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md
+++ b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md
@@ -1,4 +1,7 @@
-# Motion Path Animation
+# Motion Path Animation
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The attributes described in this topic are used to set the motion path of the component in a translation animation.
diff --git a/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md b/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
new file mode 100644
index 0000000000000000000000000000000000000000..4c985bdfc4751bc968a55bed01ad6474d0d6119e
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
@@ -0,0 +1,3905 @@
+# OffscreenCanvasRenderingConxt2D
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+Use **OffscreenCanvasRenderingContext2D** to draw rectangles, images, and text offscreen onto a canvas. Drawing offscreen onto a canvas is a process where content to draw onto the canvas is first drawn in the buffer, and then converted into a picture, and finally the picture is drawn on the canvas. This process increases the drawing efficiency.
+
+## APIs
+
+OffscreenCanvasRenderingContext2D\(width: number, height: number, setting: RenderingContextSettings\)
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ width
+
+ number
+
+ Yes
+
+ -
+
+ Width of the offscreen canvas.
+
+
+ height
+
+ number
+
+ Yes
+
+ -
+
+ Height of the offscreen canvas.
+
+
+ setting
+
+ RenderingContextSettings
+
+ Yes
+
+ -
+
+ For details, see APIs of RenderingContextSettings .
+
+
+
+
+
+
+## Attributes
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+fillStyle
+
+ <color> | CanvasGradient | CanvasPattern
+
+ -
+
+ Style to fill an area.
+When the type is <color> , this parameter indicates the color of the filling area. When the type is CanvasGradient , this parameter indicates a gradient object, which is created using the createLinearGradient method. When the type is CanvasPattern , use the createPattern method to create a pattern.
+
+
+lineWidth
+
+ number
+
+ -
+
+ Line width.
+
+
+strokeStyle
+
+ <color> | CanvasGradient | CanvasPattern
+
+ -
+
+ Stroke style.
+When the type is <color> , this parameter indicates the stroke color. When the type is CanvasGradient , this parameter indicates a gradient object, which is created using the createLinearGradient method. When the type is CanvasPattern , use the createPattern method to create a pattern.
+
+
+lineCap
+
+ string
+
+ 'butt'
+
+ Style of the specified line endpoint. The options are as follows:
+ 'butt' : The endpoints of the line are squared off. 'round' : The endpoints of the line are rounded. 'square' : The endpoints of the line are squared off, and each endpoint has added a rectangle whose length is the same as the line thickness and whose width is half of the line thickness.
+
+
+lineJoin
+
+ string
+
+ 'miter'
+
+ Style of the intersection point between line segments. The options are as follows:
+ 'round' : The intersection is a sector, whose radius at the rounded corner is equal to the line width. 'bevel' : The intersection is a triangle. The rectangular corner of each line is independent. 'miter' : The intersection has a miter corner by extending the outside edges of the lines until they meet. You can view the effect of this attribute in miterLimit .
+
+
+miterLimit
+
+ number
+
+ 10
+
+ Maximum miter length. The miter length is the distance between the inner corner and the outer corner where two lines meet.
+
+
+font
+
+ string
+
+ 'normal normal 14px sans-serif'
+
+ Font style.
+ Syntax: ctx.font='font-size font-family'
+(Optional) font-size : font size and row height. The unit can only be pixels. (Optional) font-family : font family.
+ Syntax: ctx.font='font-style font-weight font-size font-family'
+(Optional) font-style : specifies the font style. Available values are 'normal' and 'italic' . (Optional) font-weight : font weight. Available values are as follows: 'normal' , 'bold' , 'bolder' , 'lighter' , 100 , 200 , 300 , 400 , 500 , 600 , 700 , 800 , 900 (Optional) font-size : font size and row height. The unit can only be pixels. (Optional) font-family : font family. Available values are 'sans-serif' , 'serif' , and 'monospace' .
+
+
+textAlign
+
+ string
+
+ 'left'
+
+ Text alignment mode. Available values are as follows:
+ 'left' : The text is left-aligned. 'right' : The text is right-aligned. 'center' : The text is center-aligned. 'start' : The text is aligned with the start bound. 'end' : The text is aligned with the end bound.
+ NOTE: In the ltr layout mode, the value start equals left . In the rtl layout mode, the value start equals right .
+
+
+
+textBaseline
+
+ string
+
+ 'alphabetic'
+
+ Horizontal alignment mode of text. Available values are as follows:
+ 'alphabetic' : The text baseline is the normal alphabetic baseline. 'top' : The text baseline is on the top of the text bounding box. 'hanging' : The text baseline is a hanging baseline over the text. 'middle' : The text baseline is in the middle of the text bounding box. 'ideographic' : The text baseline is the ideographic baseline. If a character exceeds the alphabetic baseline, the ideographic baseline is located at the bottom of the excess character. 'bottom' : The text baseline is at the bottom of the text bounding box. Its difference from the ideographic baseline is that the ideographic baseline does not consider letters in the next line.
+
+
+globalAlpha
+
+ number
+
+ -
+
+ Opacity. 0.0 : completely transparent; 1.0 : completely opaque.
+
+
+lineDashOffset
+
+ number
+
+ 0.0
+
+ Offset of the dashed line. The precision is float.
+
+
+globalCompositeOperation
+
+ string
+
+ 'source-over'
+
+ Composition operation type. Available values are as follows: 'source-over', 'source-atop', 'source-in', 'source-out', 'destination-over', 'destination-atop', 'destination-in', 'destination-out', 'lighter', 'copy', and 'xor'.
+
+
+shadowBlur
+
+ number
+
+ 0.0
+
+ Blur level during shadow drawing. A larger value indicates a more blurred effect. The precision is float.
+
+
+shadowColor
+
+ <color>
+
+ -
+
+ Shadow color.
+
+
+shadowOffsetX
+
+ number
+
+ -
+
+ X-axis shadow offset relative to the original object.
+
+
+shadowOffsetY
+
+ number
+
+ -
+
+ Y-axis shadow offset relative to the original object.
+
+
+imageSmoothingEnabled
+
+ boolean
+
+ true
+
+ Whether to adjust the image smoothness during image drawing. The value true means to enable this feature, and false means the opposite.
+
+
+ imageSmoothingQuality
+
+ string
+
+ 'low'
+
+ Image smoothness. The value can be 'low' , 'medium' , or 'high' .
+
+
+
+
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>The value of the **** type can be in 'rgb\(255, 255, 255\)', 'rgba\(255, 255, 255, 1.0\)', or '\#FFFFFF' format.
+
+### fillStyle
+
+```
+@Entry
+@Component
+struct FillStyleExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.fillStyle = '#0000ff'
+ this.offContext.fillRect(20, 160, 150, 100)
+ var image = this.offContext.transferToImageBitmap();
+ this.context.transferFromImageBitmap(image);
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001237555173.png)
+
+### lineWidth
+
+```
+@Entry
+@Component
+struct LineWidthExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.lineWidth = 5
+ this.offContext.strokeRect(25, 25, 85, 105)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001192755194.png)
+
+### strokeStyle
+
+```
+@Entry
+@Component
+struct StrokeStyleExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.lineWidth = 10
+ this.offContext.strokeStyle = '#0000ff'
+ this.offContext.strokeRect(25, 25, 155, 105)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001237355135.png)
+
+### lineCap
+
+```
+@Entry
+@Component
+struct LineCapExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.lineWidth = 8
+ this.offContext.beginPath()
+ this.offContext.lineCap = 'round'
+ this.offContext.moveTo(30, 50)
+ this.offContext.lineTo(220, 50)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001192595232.png)
+
+### lineJoin
+
+```
+@Entry
+@Component
+struct LineJoinExample {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.beginPath()
+ this.offContext.lineWidth = 8
+ this.offContext.lineJoin = 'miter'
+ this.offContext.moveTo(30, 30)
+ this.offContext.lineTo(120, 60)
+ this.offContext.lineTo(30, 110)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001237715141.png)
+
+### miterLimit
+
+```
+@Entry
+@Component
+struct MiterLimit {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.lineWidth = 8
+ this.offContext.lineJoin = 'miter'
+ this.offContext.miterLimit = 3
+ this.offContext.moveTo(30, 30)
+ this.offContext.lineTo(60, 35)
+ this.offContext.lineTo(30, 37)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193075178.png)
+
+### font
+
+```
+@Entry
+@Component
+struct Font {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.font = '30px sans-serif'
+ this.offContext.fillText("Hello World", 20, 60)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193075164.png)
+
+### textAlign
+
+```
+@Entry
+@Component
+struct TextAlign {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.strokeStyle = '#0000ff'
+ this.offContext.moveTo(140, 10)
+ this.offContext.lineTo(140, 160)
+ this.offContext.stroke()
+
+ this.offContext.font = '18px sans-serif'
+
+ this.offContext.textAlign = 'start'
+ this.offContext.fillText('textAlign=start', 140, 60)
+ this.offContext.textAlign = 'end'
+ this.offContext.fillText('textAlign=end', 140, 80)
+ this.offContext.textAlign = 'left'
+ this.offContext.fillText('textAlign=left', 140, 100)
+ this.offContext.textAlign = 'center'
+ this.offContext.fillText('textAlign=center',140, 120)
+ this.offContext.textAlign = 'right'
+ this.offContext.fillText('textAlign=right',140, 140)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001192595234.png)
+
+### textBaseline
+
+```
+@Entry
+@Component
+struct TextBaseline {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.strokeStyle = '#0000ff'
+ this.offContext.moveTo(0, 120)
+ this.offContext.lineTo(400, 120)
+ this.offContext.stroke()
+
+ this.offContext.font = '20px sans-serif'
+
+ this.offContext.textBaseline = 'top'
+ this.offContext.fillText('Top', 10, 120)
+ this.offContext.textBaseline = 'bottom'
+ this.offContext.fillText('Bottom', 55, 120)
+ this.offContext.textBaseline = 'middle'
+ this.offContext.fillText('Middle', 125, 120)
+ this.offContext.textBaseline = 'alphabetic'
+ this.offContext.fillText('Alphabetic', 195, 120)
+ this.offContext.textBaseline = 'hanging'
+ this.offContext.fillText('Hanging', 295, 120)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193075180.png)
+
+### globalAlpha
+
+```
+@Entry
+@Component
+struct GlobalAlpha {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.fillStyle = 'rgb(255,0,0)'
+ this.offContext.fillRect(0, 0, 50, 50)
+ this.offContext.globalAlpha = 0.4
+ this.offContext.fillStyle = 'rgb(0,0,255)'
+ this.offContext.fillRect(50, 50, 50, 50)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001237715165.png)
+
+### lineDashOffset
+
+```
+@Entry
+@Component
+struct LineDashOffset {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.arc(100, 75, 50, 0, 6.28)
+ this.offContext.setLineDash([10,20])
+ this.offContext.stroke();
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001237555181.png)
+
+### globalCompositeOperation
+
+
+ Name
+
+ Description
+
+
+
+ source-over
+
+ Displays the new drawing above the existing drawing. This attribute is used by default.
+
+
+ source-atop
+
+ Displays the new drawing on the top of the existing drawing.
+
+
+ source-in
+
+ Displays the new drawing inside the existing drawing.
+
+
+ source-out
+
+ Displays the part of the new drawing that is outside of the existing drawing.
+
+
+ destination-over
+
+ Displays the existing drawing above the new drawing.
+
+
+ destination-atop
+
+ Displays the existing drawing above the new drawing.
+
+
+ destination-in
+
+ Displays the existing drawing inside the new drawing.
+
+
+ destination-out
+
+ Displays the part of the existing drawing that is outside of the new drawing.
+
+
+ lighter
+
+ Displays both the new drawing and the existing drawing.
+
+
+ copy
+
+ Displays the new drawing and neglects the existing drawing.
+
+
+ xor
+
+ Combines the new drawing and existing drawing using the XOR operation.
+
+
+
+
+
+```
+@Entry
+@Component
+struct GlobalCompositeOperation {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.fillStyle = 'rgb(255,0,0)'
+ this.offContext.fillRect(20, 20, 50, 50)
+ this.offContext.globalCompositeOperation = 'source-over'
+ this.offContext.fillStyle = 'rgb(0,0,255)'
+ this.offContext.fillRect(50, 50, 50, 50)
+ this.offContext.fillStyle = 'rgb(255,0,0)'
+ this.offContext.fillRect(120, 20, 50, 50)
+ this.offContext.globalCompositeOperation = 'destination-over'
+ this.offContext.fillStyle = 'rgb(0,0,255)'
+ this.offContext.fillRect(150, 50, 50, 50)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001237355137.png)
+
+### shadowBlur
+
+```
+@Entry
+@Component
+struct ShadowBlur {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.shadowBlur = 30
+ this.offContext.shadowColor = 'rgb(0,0,0)'
+ this.offContext.fillStyle = 'rgb(255,0,0)'
+ this.offContext.fillRect(20, 20, 100, 80)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001192755182.png)
+
+### shadowColor
+
+```
+@Entry
+@Component
+struct ShadowColor {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.shadowBlur = 30
+ this.offContext.shadowColor = 'rgb(0,0,255)'
+ this.offContext.fillStyle = 'rgb(255,0,0)'
+ this.offContext.fillRect(30, 30, 100, 100)
+ var image = this.offContext.transferToImageBitmap
+()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001237555155.png)
+
+### shadowOffsetX
+
+```
+@Entry
+@Component
+struct ShadowOffsetX {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.shadowBlur = 10
+ this.offContext.shadowOffsetX = 20
+ this.offContext.shadowColor = 'rgb(0,0,0)'
+ this.offContext.fillStyle = 'rgb(255,0,0)'
+ this.offContext.fillRect(20, 20, 100, 80)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001193075168.png)
+
+### shadowOffsetY
+
+```
+@Entry
+@Component
+struct ShadowOffsetY {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.shadowBlur = 10
+ this.offContext.shadowOffsetY = 20
+ this.offContext.shadowColor = 'rgb(0,0,0)'
+ this.offContext.fillStyle = 'rgb(255,0,0)'
+ this.offContext.fillRect(30, 30, 100, 100)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001237475139.png)
+
+### imageSmoothingEnabled
+
+```
+@Entry
+@Component
+struct ImageSmoothingEnabled {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private img:ImageBitmap = new ImageBitmap("common/images/icon.jpg")
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.imageSmoothingEnabled = false
+ this.offContext.drawImage( this.img,0,0,400,200)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+}
+```
+
+![](figures/en-us_image_0000001237355121.png)
+
+## Methods
+
+### fillRect
+
+fillRect\(x: number, y: number, w: number, h: number\): void
+
+Fills a rectangle on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle.
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the rectangle.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the rectangle.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct FillRect {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.fillRect(0,30,100,100)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237475123.png)
+
+
+### strokeRect
+
+strokeRect\(x: number, y: number, w: number, h: number\): void
+
+Draws a rectangle stroke on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle stroke.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle stroke.
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the rectangle.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the rectangle.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct StrokeRect {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.strokeRect(30, 30, 200, 150)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192755180.png)
+
+
+### clearRect
+
+clearRect\(x: number, y: number, w: number, h: number\): void
+
+Clears the content in a rectangle on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle.
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the rectangle.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the rectangle.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct ClearRect {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.fillStyle = 'rgb(0,0,255)'
+ this.offContext.fillRect(0,0,500,500)
+ this.offContext.clearRect(20,20,150,100)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/11111-5.png)
+
+
+### fillText
+
+fillText\(text: string, x: number, y: number\): void
+
+Draws filled text on the canvas.
+
+- Parameters
+
+
+ Parameters
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ text
+
+ string
+
+ Yes
+
+ ""
+
+ Text to draw.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the lower left corner of the text.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the lower left corner of the text.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct FillText {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.font = '30px sans-serif'
+ this.offContext.fillText("Hello World!", 20, 100)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237555165.png)
+
+
+### strokeText
+
+strokeText\(text: string, x: number, y: number\): void
+
+Draws a text stroke on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ text
+
+ string
+
+ Yes
+
+ ""
+
+ Text to draw.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the lower left corner of the text.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the lower left corner of the text.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct StrokeText {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.font = '55px sans-serif'
+ this.offContext.strokeText("Hello World!", 20, 60)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237715149.png)
+
+
+### measureText
+
+measureText\(text: string\): TextMetrics
+
+Returns a **TextMetrics** object used to obtain the width of specified text.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ text
+
+ string
+
+ Yes
+
+ ""
+
+ Text to be measured.
+
+
+
+
+
+- Return values
+
+
+ Type
+
+ Description
+
+
+
+ TextMetrics
+
+ TextMetrics object.
+
+
+
+
+
+- **TextMetrics** attributes
+
+
+ Attribute
+
+ Type
+
+ Description
+
+
+
+ width
+
+ number
+
+ Width of the text string.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct MeasureText {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.font = '50px sans-serif'
+ this.offContext.fillText("Hello World!", 20, 100)
+ this.offContext.fillText("width:" + this.context.measureText("Hello World!").width, 20, 200)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193075172.png)
+
+
+### stroke
+
+stroke\(path?: Path2D\): void
+
+Strokes a path.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ path
+
+ Path2D
+
+ No
+
+ null
+
+ A Path2D path to draw.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Stroke {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenRenderingContext(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.moveTo(25, 25)
+ this.offContext.lineTo(25, 105)
+ this.offContext.strokeStyle = 'rgb(0,0,255)'
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192595220.png)
+
+
+### beginPath
+
+beginPath\(\): void
+
+Creates a drawing path.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct BeginPath {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.beginPath()
+ this.offContext.lineWidth = 6
+ this.offContext.strokeStyle = '#0000ff'
+ this.offContext.moveTo(15, 80)
+ this.offContext.lineTo(280, 160)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237555163.png)
+
+
+### moveTo
+
+moveTo\(x: number, y: number\): void
+
+Moves a drawing path to a target position on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the target position.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the target position.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct MoveTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.beginPath()
+ this.offContext.moveTo(10, 10)
+ this.offContext.lineTo(280, 160)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192595228.png)
+
+
+### lineTo
+
+lineTo\(x: number, y: number\): void
+
+Connects the current point to a target position using a straight line.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the target position.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the target position.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct LineTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.beginPath()
+ this.offContext.moveTo(10, 10)
+ this.offContext.lineTo(280, 160)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237715151.png)
+
+
+### closePath
+
+closePath\(\): void
+
+Draws a closed path.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct ClosePath {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.beginPath()
+ this.offContext.moveTo(30, 30)
+ this.offContext.lineTo(110, 30)
+ this.offContext.lineTo(70, 90)
+ this.offContext.closePath()
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192595224.png)
+
+
+### createPattern
+
+createPattern\(image: ImageBitmap, repetition: string\): CanvasPattern
+
+Creates a pattern for image filling based on a specified source image and repetition mode.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ image
+
+ ImageBitmap
+
+ Yes
+
+ null
+
+ Source image. For details, see ImageBitmap .
+
+
+ repetition
+
+ string
+
+ Yes
+
+ ""
+
+ Repetition mode. The value can be 'repeat' , 'repeat-x' , 'repeat-y' , or 'no-repeat' .
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct CreatePattern {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private img:ImageBitmap = new ImageBitmap("common/images/icon.jpg")
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ var pattern = this.offContext.createPattern(this.img, 'repeat')
+ this.offContext.fillStyle = pattern
+ this.offContext.fillRect(0, 0, 200, 200)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237475133.png)
+
+
+### bezierCurveTo
+
+bezierCurveTo\(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number\): void
+
+Draws a cubic bezier curve on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ cp1x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the first parameter of the bezier curve.
+
+
+ cp1y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the first parameter of the bezier curve.
+
+
+ cp2x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the second parameter of the bezier curve.
+
+
+ cp2y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the second parameter of the bezier curve.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the end point on the bezier curve.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the end point on the bezier curve.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct BezierCurveTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.beginPath()
+ this.offContext.moveTo(10, 10)
+ this.offContext.bezierCurveTo(20, 100, 200, 100, 200, 20)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237715153.png)
+
+
+### quadraticCurveTo
+
+quadraticCurveTo\(cpx: number, cpy: number, x: number, y: number\): void
+
+Draws a quadratic curve on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ cpx
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the bezier curve parameter.
+
+
+ cpy
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the bezier curve parameter.
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the end point on the bezier curve.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the end point on the bezier curve.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct QuadraticCurveTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.beginPath();
+ this.offContext.moveTo(20, 20);
+ this.offContext.quadraticCurveTo(100, 100, 200, 20);
+ this.offContext.stroke();
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192915184.png)
+
+
+### arc
+
+arc\(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean\): void
+
+Draws an arc on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the center point of the arc.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the center point of the arc.
+
+
+ radius
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the arc.
+
+
+ startAngle
+
+ number
+
+ Yes
+
+ 0
+
+ Start radian of the arc.
+
+
+ endAngle
+
+ number
+
+ Yes
+
+ 0
+
+ End radian of the arc.
+
+
+ anticlockwise
+
+ boolean
+
+ No
+
+ false
+
+ Whether to draw the arc counterclockwise.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Arc {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.beginPath()
+ this.offContext.arc(100, 75, 50, 0, 6.28)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192595226.png)
+
+
+### arcTo
+
+arcTo\(x1: number, y1: number, x2: number, y2: number, radius: number\): void
+
+Draws an arc based on the radius and points on the arc.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x1
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the first point on the arc.
+
+
+ y1
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the first point on the arc.
+
+
+ x2
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the second point on the arc.
+
+
+ y2
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the second point on the arc.
+
+
+ radius
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the arc.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct ArcTo {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.moveTo(100, 20);
+ this.offContext.arcTo(150, 20, 150, 70, 50);
+ this.offContext.stroke();
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237555167.png)
+
+
+### ellipse
+
+ellipse\(x: number, y: number, radiusX: number, radiusY: number, rotation: number, startAngle: number, endAngle: number, anticlockwise?: boolean\): void
+
+Draws an ellipse in the specified rectangular region.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the ellipse center.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the ellipse center.
+
+
+ radiusX
+
+ number
+
+ Yes
+
+ 0
+
+ Ellipse radius on the x-axis.
+
+
+ radiusY
+
+ number
+
+ Yes
+
+ 0
+
+ Ellipse radius on the y-axis.
+
+
+ rotation
+
+ number
+
+ Yes
+
+ 0
+
+ Rotation angle of the ellipse, in radians.
+
+
+ startAngle
+
+ number
+
+ Yes
+
+ 0
+
+ Angle of the start point for drawing the ellipse, in radians.
+
+
+ endAngle
+
+ number
+
+ Yes
+
+ 0
+
+ Angle of the end point for drawing the ellipse, in radians.
+
+
+ anticlockwise
+
+ boolean
+
+ No
+
+ false
+
+ Whether to draw the ellipse in the counterclockwise direction. The value 0 means to draw the ellipse in the clockwise direction, and 1 means to draw the ellipse in the counterclockwise direction. This parameter is optional. The default value is 0 .
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Ellipse {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.beginPath()
+ this.offContext.ellipse(200, 200, 50, 100, Math.PI * 0.25, Math.PI * 0.5, Math.PI, true)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237355131.png)
+
+
+### rect
+
+rect\(x: number, y: number, width: number, height: number\): void
+
+Creates a rectangle.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle.
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the rectangle.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the rectangle.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Rect {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.rect(20, 20, 100, 100) // Create a 100*100 rectangle at (20, 20)
+ this.offContext.stroke()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237715155.png)
+
+
+### fill
+
+fill\(\): void
+
+Fills the area inside a closed path.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Fill {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.rect(20, 20, 100, 100) // Create a 100*100 rectangle at (20, 20)
+ this.offContext.fill()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193075166.png)
+
+
+### clip
+
+clip\(\): void
+
+Sets the current path to a clipping path.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Clip {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.rect(0, 0, 200, 200)
+ this.offContext.stroke()
+ this.offContext.clip()
+ this.offContext.fillStyle = "rgb(255,0,0)"
+ this.offContext.fillRect(0, 0, 150, 150)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192595238.png)
+
+
+### rotate
+
+rotate\(rotate: number\): void
+
+Rotates a canvas clockwise around its coordinate axes.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ rotate
+
+ number
+
+ Yes
+
+ 0
+
+ Clockwise rotation angle. You can use Math.PI / 180 to convert the angle to a radian.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Rotate {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.rotate(45 * Math.PI / 180) // Rotate the rectangle 45 degrees
+ this.offContext.fillRect(70, 20, 50, 50)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237355133.png)
+
+
+### scale
+
+scale\(x: number, y: number\): void
+
+Scales a canvas based on scaling factors.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ Horizontal scale factor.
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Vertical scale factor.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Scale {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.strokeRect(10, 10, 25, 25)
+ this.offContext.scale(2, 2) // Scale to 200%
+ this.offContext.strokeRect(10, 10, 25, 25)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192755178.png)
+
+
+### transform
+
+transform\(scaleX: number, skewX: number, skewY: number, scaleY: number, translateX: number, translateY: number\): void
+
+Defines a transformation matrix. To transform a graph, you only need to set parameters of the matrix. The coordinates of the graph are multiplied by the matrix values to obtain new coordinates of the transformed graph. You can use the matrix to implement multiple transform effects.
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>The following formulas calculate coordinates of the transformed graph. **x** and **y** represent coordinates before transformation, and **x'** and **y'** represent coordinates after transformation.
+>- x' = scaleX \* x + skewY \* y + translateX
+>- y' = skewX \* x + scaleY \* y + translateY
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ scaleX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis scale.
+
+
+ skewX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis skew.
+
+
+ skewY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis skew.
+
+
+ scaleY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis scale.
+
+
+ translateX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis translation.
+
+
+ translateY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis translation.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Transform {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.fillStyle = 'rgb(0,0,0)'
+ this.offContext.fillRect(0, 0, 100, 100)
+ this.offContext.transform(1, 0.5, -0.5, 1, 10, 10)
+ this.offContext.fillStyle = 'rgb(255,0,0)'
+ this.offContext.fillRect(0, 0, 100, 100)
+ this.offContext.transform(1, 0.5, -0.5, 1, 10, 10)
+ this.offContext.fillStyle = 'rgb(0,0,255)'
+ this.offContext.fillRect(0, 0, 100, 100)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192595230.png)
+
+
+### setTransform
+
+setTransform\(scaleX: number, skewX: number, skewY: number, scale: number, translateX: number, translateY: number\): void
+
+Resets the existing transformation matrix and creates a new transformation matrix by using the same parameters as the **transform\(\)** function.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ scaleX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis scale.
+
+
+ skewX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis skew.
+
+
+ skewY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis skew.
+
+
+ scaleY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis scale.
+
+
+ translateX
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis translation.
+
+
+ translateY
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis translation.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct SetTransform {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.fillStyle = 'rgb(255,0,0)'
+ this.offContext.fillRect(0, 0, 100, 100)
+ this.offContext.setTransform(1,0.5, -0.5, 1, 10, 10)
+ this.offContext.fillStyle = 'rgb(0,0,255)'
+ this.offContext.fillRect(0, 0, 100, 100)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237715159.png)
+
+
+### translate
+
+translate\(x: number, y: number\): void
+
+Moves the origin of the coordinate system.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis translation
+
+
+ y
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis translation.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Translate {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.fillRect(10, 10, 50, 50)
+ this.offContext.translate(70, 70)
+ this.offContext.fillRect(10, 10, 50, 50)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237475137.png)
+
+
+### drawImage
+
+drawImage\(image: ImageBitmap, dx: number, dy: number\): void
+
+drawImage\(image: ImageBitmap, dx: number, dy: number, dWidth: number, dHeight: number\): void
+
+drawImage\(image: ImageBitmap, sx: number, sy: number, sWidth: number, sHeight: number, dx: number, dy: number, dWidth: number, dHeight: number\):void
+
+Draws an image.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ image
+
+ ImageBitmap
+
+ Yes
+
+ null
+
+ Image resource. For details, see ImageBitmap .
+
+
+ sx
+
+ number
+
+ No
+
+ 0
+
+ X-coordinate of the upper left corner of the rectangle used to crop the source image.
+
+
+ sy
+
+ number
+
+ No
+
+ 0
+
+ Y-coordinate of the upper left corner of the rectangle used to crop the source image.
+
+
+ sWidth
+
+ number
+
+ No
+
+ 0
+
+ Target width to crop the source image.
+
+
+ sHeight
+
+ number
+
+ No
+
+ 0
+
+ Target height to crop the source image.
+
+
+ dx
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the drawing area on the canvas.
+
+
+ dy
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the drawing area on the canvas.
+
+
+ dWidth
+
+ number
+
+ No
+
+ 0
+
+ Width of the drawing area.
+
+
+ dHeight
+
+ number
+
+ No
+
+ 0
+
+ Height of the drawing area.
+
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Index {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private img:ImageBitmap = new ImageBitmap("common/images/icon.jpg")
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() => {
+ this.offContext.drawImage( this.img,0,0,400,200)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192915180.png)
+
+
+### createImageData
+
+createImageData\(width: number, height: number\): Object
+
+Creates an **ImageData** object based on the specified width and height. For details, see [ImageData](ts-components-canvas-imagedata.md).
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default
+
+ Description
+
+
+
+ width
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the ImageData object.
+
+
+ height
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the ImageData object.
+
+
+
+
+
+
+### createImageData
+
+createImageData\(imageData: ImageData\): Object
+
+Creates an **ImageData** object by copying an existing **ImageData** object. For details, see [ImageData](ts-components-canvas-imagedata.md).
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default
+
+ Description
+
+
+
+ imagedata
+
+ ImageData
+
+ Yes
+
+ null
+
+ ImageData object to copy.
+
+
+
+
+
+
+### getImageData
+
+getImageData\(sx: number, sy: number, sw: number, sh: number\): Object
+
+Creates an [ImageData](ts-components-canvas-imagedata.md) object with pixels in the specified area on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ sx
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the upper left corner of the output area.
+
+
+ sy
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the upper left corner of the output area.
+
+
+ sw
+
+ number
+
+ Yes
+
+ 0
+
+ Width of the output area.
+
+
+ sh
+
+ number
+
+ Yes
+
+ 0
+
+ Height of the output area.
+
+
+
+
+
+
+### putImageData
+
+putImageData\(imageData: Object, dx: number, dy: number, dirtyX?: number, dirtyY?: number, dirtyWidth?: number, dirtyHeight?: number\): void
+
+Puts the [ImageData](ts-components-canvas-imagedata.md) onto a rectangular area on the canvas.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ imagedata
+
+ Object
+
+ Yes
+
+ null
+
+ ImageData object with pixels to put onto the canvas.
+
+
+ dx
+
+ number
+
+ Yes
+
+ 0
+
+ X-axis offset of the rectangular area on the canvas.
+
+
+ dy
+
+ number
+
+ Yes
+
+ 0
+
+ Y-axis offset of the rectangular area on the canvas.
+
+
+ dirtyX
+
+ number
+
+ No
+
+ 0
+
+ X-axis offset of the upper left corner of the rectangular area relative to that of the source image.
+
+
+ dirtyY
+
+ number
+
+ No
+
+ 0
+
+ Y-axis offset of the upper left corner of the rectangular area relative to that of the source image.
+
+
+ dirtyWidth
+
+ number
+
+ No
+
+ Width of the ImageData object
+
+ Width of the rectangular area to crop the source image.
+
+
+ dirtyHeight
+
+ number
+
+ No
+
+ Height of the ImageData object
+
+ Height of the rectangular area to crop the source image.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct PutImageData {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ var imageData = this.offContext.createImageData(100, 100)
+ for (var i = 0; i < imageData.data.length; i += 4) {
+ imageData.data[i + 0] = 255
+ imageData.data[i + 1] = 0
+ imageData.data[i + 2] = 255
+ imageData.data[i + 3] = 255
+ }
+ this.offContext.putImageData(imageData, 10, 10)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001193075170.png)
+
+
+### restore
+
+restore\(\): void
+
+Restores the saved drawing context.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Restore {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.restore()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+
+### save
+
+save\(\): void
+
+Saves the current drawing context.
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct Restore {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ this.offContext.save()
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+
+### createLinearGradient
+
+createLinearGradient\(x0: number, y0: number, x1: number, y1: number\): void
+
+Creates a linear gradient.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x0
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the start point.
+
+
+ y0
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the start point.
+
+
+ x1
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the end point.
+
+
+ y1
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the end point.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct CreateLinearGradient {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private gra:CanvasGradient = new CanvasGradient()
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ var grad = this.offContext.createLinearGradient(50,0, 300,100)
+ this.gra.addColorStop(0.0, 'red')
+ this.gra.addColorStop(0.5, 'white')
+ this.gra.addColorStop(1.0, 'green')
+ this.offContext.fillStyle = grad
+ this.offContext.fillRect(0, 0, 500, 500)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001192915162.png)
+
+
+### createRadialGradient
+
+createRadialGradient\(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number\): void
+
+Creates a linear gradient.
+
+- Parameters
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x0
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the center of the start circle.
+
+
+ y0
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the center of the start circle.
+
+
+ r0
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the start circle, which must be a non-negative finite number.
+
+
+ x1
+
+ number
+
+ Yes
+
+ 0
+
+ X-coordinate of the center of the end circle.
+
+
+ y1
+
+ number
+
+ Yes
+
+ 0
+
+ Y-coordinate of the center of the end circle.
+
+
+ r1
+
+ number
+
+ Yes
+
+ 0
+
+ Radius of the end circle, which must be a non-negative finite number.
+
+
+
+
+
+- Example
+
+ ```
+ @Entry
+ @Component
+ struct CreateRadialGradient {
+ private settings: RenderingContextSettings = new RenderingContextSettings(true,true)
+ private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings)
+ private gra:CanvasGradient = new CanvasGradient()
+ private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings)
+ build() {
+ Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
+ Canvas(this.context)
+ .width('100%')
+ .height('100%')
+ .backgroundColor('#ffff00')
+ .onReady(() =>{
+ var grad = this.offContext.createRadialGradient(200,200,50, 200,200,200)
+ this.gra.addColorStop(0.0, 'red')
+ this.gra.addColorStop(0.5, 'white')
+ this.gra.addColorStop(1.0, 'green')
+ this.offContext.fillStyle = grad
+ this.offContext.fillRect(0, 0, 500, 500)
+ var image = this.offContext.transferToImageBitmap()
+ this.context.transferFromImageBitmap(image)
+ })
+ }
+ .width('100%')
+ .height('100%')
+ }
+ }
+ ```
+
+ ![](figures/en-us_image_0000001237555179.png)
+
+
+## CanvasPattern
+
+Defines an object created by using the [createPattern](#section660873113512) method.
+
diff --git a/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md b/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md
index 59d73ec0be1db23323e6899a5fad27840790177d..b1b9c60825e06db19965cf57f494c3b1216076f8 100644
--- a/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md
+++ b/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md
@@ -1,11 +1,14 @@
-# Page Transition
+# Page Transition
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
Customize the page transition animations by configuring the page entrance and exit components in the global **pageTransition** method.
- Component
+ Name
- Parameter
+ Type
Description
diff --git a/en/application-dev/reference/arkui-ts/ts-syntax-intro.md b/en/application-dev/reference/arkui-ts/ts-syntax-intro.md
deleted file mode 100644
index 637d6dd902e360017b17a733c86751efcd2d0ffa..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/arkui-ts/ts-syntax-intro.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# Overview
-
-This section defines the core mechanism and functions of the TypeScript-based declarative development paradigm. It describes declarative UI descriptions, componentization mechanisms, UI state management, rendering control syntax, and syntactic sugar to enhance programming language functionality.
-
-Follow the provided guidelines for UI development. For details about the components, see [Components](ts-universal-events-click.md).
-
->![](../../public_sys-resources/icon-note.gif) **NOTE:**
->- All examples use the TypeScript \(TS\) language. If you are using other languages, comply with the syntax requirements of the corresponding language.
->- The components used in the examples are preset in the UI framework and are used only to explain the UI description specifications.
->- Common attribute and event methods generally apply to all components, and the attribute and event methods within a component apply only to the current component.
-
diff --git a/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md b/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md
index ba406384d9c21cbbddaf835c24b2c41ece850879..f6fc3dd221ed86729f59f31edbf46911232b11e0 100644
--- a/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md
+++ b/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md
@@ -1,4 +1,7 @@
-# Component Transition
+# Component Transition
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
Configure the component transition animations for when a component is inserted or deleted, which improves user experience. This feature takes effect only when **animateTo** is used. The animation duration, curve, and delay are the same as those configured in **animateTo**.
diff --git a/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md b/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md
index d6031abac7c6b10b3fbeb0eaf81f34ab696bba54..a73b337b47d8ffa16af12d0a831c538d04467744 100644
--- a/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md
+++ b/en/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md
@@ -1,4 +1,7 @@
-# Transition of Shared Elements
+# Transition of Shared Elements
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This animation is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
Shared element transition can be used for transition between pages, for example, transition from an image on the current page to the next page.
diff --git a/en/application-dev/reference/arkui-ts/ts-transition-animation.md b/en/application-dev/reference/arkui-ts/ts-transition-animation.md
index ea0c5b7823bec374697970b4442d467f96134a5b..590b23e37aa735e0b641bb0d129f09da4972323c 100644
--- a/en/application-dev/reference/arkui-ts/ts-transition-animation.md
+++ b/en/application-dev/reference/arkui-ts/ts-transition-animation.md
@@ -1,4 +1,4 @@
-# Transition Animation
+# Transition Animation
- **[Page Transition](ts-page-transition-animation.md)**
diff --git a/en/application-dev/reference/arkui-ts/ts-ui-state-mgmt-concepts.md b/en/application-dev/reference/arkui-ts/ts-ui-state-mgmt-concepts.md
deleted file mode 100644
index 3418214b399b6d08faf0a65e3179bc85ccc7af75..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/arkui-ts/ts-ui-state-mgmt-concepts.md
+++ /dev/null
@@ -1,22 +0,0 @@
-# Basic Concepts
-
-In the declarative UI programming paradigm, the UI is a function of an application state, and you update a UI by modifying the current application state.
-
-The development framework provides various application state management capabilities.
-
-![](figures/corespec_figures_state-mgmt-overview.png)
-
-## State Variable Decorators
-
-- **@State**: state attribute of the component. Each time the **@State** annotated variable changes, the component re-renders and updates the UI.
-- **@Link**: The component depends on some state attributes of its parent component. Each time the data in one component is updated, the state of the other component is updated, and the parent and child components are rendered again.
-- **@Prop**: The working principle is similar to that of **@Link**. The only difference is that the changes made by a child component are not synchronized to the parent component.
-
-## Application State Data
-
-**AppStorage** is the central "database" of the application states used in the entire UI. The UI framework creates a singleton **AppStorage** object for the application and provides the corresponding decorators and APIs for the application.
-
-- **@StorageLink**: The working principle of **@StorageLink\(_name_\)** is similar to that of **@Consume\(_name_\)**. The difference is that the link object with the specified name is obtained from the **AppStorage**. It establishes bidirectional binding between the UI component and **AppStorage** to synchronize data.
-- **@StorageProp**: **@StorageProp\(_name_\)** synchronizes UI component attributes with the **AppStorage** unidirectionally. The value change in the **AppStorage** updates the attribute value in the component, but the UI component cannot change the attribute value in the **AppStorage**.
-- The **AppStorage** also provides an API for service logic implementation. The API is used to add, read, modify, and delete the state attributes of applications. The changes made through this API will cause the modified state data to be synchronized to the UI component for UI update.
-
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md
index 105457106373a2ee2bc6a1013e56d53899198621..38ccc9ff5839ffd750bf5e4f5a3673d176d12290 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md
@@ -1,7 +1,16 @@
-# Background
+# Background
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The attributes in this topic are used to set the background color of a component.
+## Required Permissions
+
+None
+
+## Attributes
+
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md
index 06bcb51271a75269aa517bf69205dfb6265d26d7..e26571ee07d079fa89ecb48379084e85a5032f00 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border.md
@@ -1,7 +1,16 @@
-# Border Configuration
+# Border Configuration
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
This section describes the settings of border styles.
+## Required Permissions
+
+None
+
+## Attributes
+
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md
index fa4303a59a41588717a32de3a7b22f8112dfa036..9d6b1249786664f03c83e8544e32c860aef8a6a2 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md
@@ -1,11 +1,20 @@
-# Enable/Disable
+# Enable/Disable
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
- Type
+ Type
- Default Value
+ Default Value
Description
@@ -13,9 +22,9 @@
enabled
- boolean
+ boolean
- true
+ true
The value true means that the component is available and can respond to operations such as clicking. The value false means that the component does not respond to operations such as clicking.
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md
index 035300f34041f66c5c82735e3b85794b1adbf217..6423acb80767eded69d695f15723ef1d92660dd5 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md
@@ -1,7 +1,14 @@
-# Flex Layout
+# Flex Layout
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The attributes described in this topic are valid only when the parent component is **Flex**.
+>- This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+>- This attribute is valid only when the parent component is a **Flex** component.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md
index a3892025437454339092bd2af488934b2016a078..754e983d7efc929ff9890c9095a61be8784eafc5 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md
@@ -1,4 +1,13 @@
-# Gradient Color
+# Gradient Color
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
@@ -14,9 +23,9 @@
linearGradient
{
- angle?: Angle ,
+ angle?: Angle ,
direction?:GradientDirection ,
- colors: Array<ColorStop >
+ colors: Array<ColorStop >
repeating?: boolean
}
@@ -35,7 +44,7 @@
center: Point,
start?: angle,
end?: angle,
- colors: Array<ColorStop >
+ colors: Array<ColorStop >
repeating?: boolean
}
@@ -54,7 +63,7 @@
{
center: Point,
radius: Length,
- colors: Array<ColorStop >
+ colors: Array<ColorStop >
repeating: boolean
}
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md
index b14861d3ca54b05dd4ca4d9037b3491941c35d89..941a38b140b9b86cb767935e9895a676dfed1c8e 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md
@@ -1,7 +1,14 @@
-# Grid
+# Grid
>![](../../public_sys-resources/icon-note.gif) **NOTE:**
->The column width and column gap in the grid layout are determined by the nearest parent component **GridContainer**. The component tree that uses grid attributes must contain one **GridContainer** or more.
+>- This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+>- The column width and column gap in the grid layout are determined by the nearest parent component **GridContainer**. The component tree that uses grid attributes must contain one **GridContainer** or more.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md
index 84dad7dcda292a38fdd8329160b092d3024c7aa8..a5e0d3e0add09867b6380c00df0b8dc8323c36d3 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md
@@ -1,4 +1,13 @@
-# Image Effect Configuration
+# Image Effect Configuration
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
@@ -88,6 +97,15 @@
Inverts the input image. The input parameter is an image inversion ratio. The value 1 indicates complete inversion. The value 0 indicates that the image does not change. The unit is percentage.
+ colorBlend 8+
+
+ Color
+
+ -
+
+ Adds the color blend effect to the current component. The input parameter is the blended color.
+
+
sepia
number
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md
index 9a6499b42e2afbfed033956fe81891d2cf25ff46..cb9ef84f00640333a638c95a2bf1bb7e00cb1179 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md
@@ -1,4 +1,13 @@
-# Layout Constraints
+# Layout Constraints
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
@@ -27,7 +36,7 @@
-
Sets a display priority for the current component in the layout container. When the space of the parent container is insufficient, the component with a lower priority is hidden.
- NOTE: This parameter is valid only for the Row/Column/Flex (single-row) container component.
+
NOTE: This parameter is valid only for the Row/Column/Flex (single-row) container component.
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md
index 21797c3cd9337ae1fddeefebc22a32649c1f0b02..a3617a10670716c6dfa63416a42f49fede8b21c8 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md
@@ -1,4 +1,13 @@
-# Location
+# Location
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md
index 77759cd3be9b6ca5a7bde7c9c9830fe4239d8d54..662930943e64d809c4d961b371be83ca95d91a3d 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-menu.md
@@ -1,4 +1,13 @@
-# Menu Control
+# Menu Control
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
@@ -13,11 +22,11 @@
bindMenu
- Array<MenuItem >
+ Array<MenuItem > | CustomBuilder 8+
-
- Binds the menu to a component. If you click a component bound to the menu, the menu is displayed.
+ Binds the menu to a component. If you click a component bound to the menu, the menu is displayed. The menu can be in text or custom type.
@@ -57,7 +66,7 @@
```
@Entry
@Component
-struct menuExample {
+struct MenuExample {
build() {
Column() {
Text('click for Menu')
@@ -84,3 +93,51 @@ struct menuExample {
![](figures/menu.gif)
+```
+import router from '@system.router';
+
+@Entry
+@Component
+struct MenuExample {
+ @Builder MenuBuilder() {
+ Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
+ Text('text1')
+ .fontSize(20)
+ .width(100)
+ .height(50)
+ .textAlign(TextAlign.Center)
+
+ Divider().height(10)
+
+ Text('text2')
+ .fontSize(20)
+ .width(100)
+ .height(50)
+ .textAlign(TextAlign.Center)
+
+ Divider().height(10)
+
+ Button('Next')
+ .fontSize(20)
+ .width(100)
+ .height(50)
+ .onClick(() => {
+ router.push({ uri: 'pages/details' })
+ })
+
+ }.width(100)
+ }
+
+ build() {
+ Column() {
+ Text('click for menu')
+ }
+ .width('100%')
+ .margin({ top: 5 })
+ .bindMenu(this.MenuBuilder)
+ }
+}
+```
+
+![](figures/gif.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md
index 05bb0fddfd3d678cd86c4ca8e8398835a3c7ca0d..1103e964b2be11cae8ab1872dbfeab81838b3c32 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md
@@ -1,7 +1,16 @@
-# Opacity
+# Opacity
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The attributes described in this topic are used to set the opacity of a component.
+## Required Permissions
+
+None
+
+## Attributes
+
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md
index d92cfd65b8bde783914a74e830364ce0db2df4fb..005b5faf00fb2dbec0b720fd7e7cbd700617773d 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md
@@ -1,4 +1,13 @@
-# Overlay
+# Overlay
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
@@ -44,7 +53,7 @@ struct OverlayExample {
Column() {
Image($r('app.media.img'))
.width(240).height(240)
- .overlay("Don't walk and play with your phone.", { align: Alignment.Bottom, offset: { x: 0, y: -15 } })
+ .overlay("Winter is a beautiful season, especially when it snows.", { align: Alignment.Bottom, offset: { x: 0, y: -15 } })
}.border({ color: Color.Black, width: 2 })
}.width('100%')
}.padding({ top: 20 })
@@ -52,5 +61,5 @@ struct OverlayExample {
}
```
-![](figures/overlay.gif)
+![](figures/en-us_image_0000001194911566.png)
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md
index 44fe93b09dfbe3c1d4c380a20ed07d9efcd443e3..e0ec8e6def24f08eecdacc1233f563abe4427a43 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md
@@ -1,48 +1,271 @@
-# Popup Control
+# Popup Control
-
- Name
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
+
+
+ Name
- Type
+ Type
- Default Value
+ Default Value
- Description
+ Description
- bindPopup
+ bindPopup
- {
- show: boolean,
- popup: {
- message: string,
- placementOnTop: boolean,
- primaryButton?: {
- value: string,
- action: ()=>void
- },
- secondaryButton?:{
- value: string,
- action: () =>void
- },
- onStateChange?: (isVisible: boolean) => void
- }
- }
+ show: boolean,
+ popup: PopupOption | CustomPopupOption
- -
+ -
- show : whether to display the current popup message. The default value is false .
- message : content of the popup message.
- placementOnTop : whether to display the popup message above the component. The default value is false .
- primaryButton : first button.
- secondaryButton : second button.
- onStateChange : callback for the popup window status change event. The argument is the visibility status of the current popup window.
+ Settings of the popup bound to a component.
+ show : whether to display the popup message on the creation page by default. The default value is false .
+ popup: parameters of the current popup window.
+- PopupOption APIs
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ message
+
+ string
+
+ Yes
+
+ -
+
+ Content of the popup message.
+
+
+ placementOnTop
+
+ boolean
+
+ No
+
+ false
+
+ Whether to display the popup message above the component. The default value is false .
+
+
+ primaryButton
+
+ {
+ value: string,
+ action: () => void
+ }
+
+ No
+
+ -
+
+ The first button.
+ value : text of the primary button in the popup.
+ action : callback function for tapping the primary button.
+
+
+ secondaryButton
+
+ {
+ value: string,
+ action: () => void
+ }
+
+ No
+
+ -
+
+ Second button.
+ value : text of the secondary button in the popup.
+ action : callback function for tapping the secondary button.
+
+
+ onStateChange
+
+ (isVisible: boolean) => void
+
+ No
+
+ -
+
+ Callback for the popup status change event. The parameter isVisible indicates the visibility of the popup.
+
+
+
+
+
+- CustomPopupOption APIs8+
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ builder
+
+ () => any
+
+ Yes
+
+ -
+
+ Builder of the tooltip content.
+
+
+ placement
+
+ Placement
+
+ No
+
+ Placement.Bottom
+
+ Preferred position of the tooltip component. If the set position is insufficient for holding the component, it will be automatically adjusted.
+
+
+ maskColor
+
+ Color
+
+ No
+
+ -
+
+ Color of the tooltip mask.
+
+
+ popupColor
+
+ Color
+
+ No
+
+ -
+
+ Color of the tooltip.
+
+
+ enableArrow
+
+ boolean
+
+ No
+
+ true
+
+ Whether to display arrows. Arrows are displayed only for tooltips in the up and down directions.
+
+
+ autoCancel
+
+ boolean
+
+ No
+
+ true
+
+ Whether to automatically close the tooltip when an operation is performed on the page.
+
+
+ onStateChange
+
+ (isVisible: boolean) => void
+
+ No
+
+ -
+
+ Callback for the popup status change event. The parameter isVisible indicates the visibility of the popup.
+
+
+
+
+
+- Placement enums8+
+
+
+ Name
+
+ Description
+
+
+
+ Left
+
+ The tooltip is on the left of the component.
+
+
+ Right
+
+ The tooltip is on the right of the component.
+
+
+ Top
+
+ The tooltip is on the top of the component.
+
+
+ Bottom
+
+ The tooltip is at the bottom of the component.
+
+
+ TopLeft
+
+ The tooltip is in the upper left corner of the component.
+
+
+ TopRight
+
+ The tooltip is in the upper right corner of the component.
+
+
+ BottomLeft
+
+ The tooltip is in the lower left corner of the component.
+
+
+ BottomRight
+
+ The tooltip is in the lower right corner of the component.
+
+
+
+
+
+
## Example
```
@@ -51,16 +274,23 @@
struct PopupExample {
@State noHandlePopup: boolean = false
@State handlePopup: boolean = false
+ @State customPopup: boolean = false
+
+ @Builder popupBuilder() {
+ Row({ space: 2 }) {
+ Image('/resource/ic_public_thumbsup.svg').width(24).height(24).margin({ left: -5 })
+ Text('Custom Popup').fontSize(12)
+ }.width(100).height(50).backgroundColor(Color.White)
+ }
build() {
- Column({ space: 160 }) {
+ Flex({ direction: FlexDirection.Column }) {
Button('no handle popup')
.onClick(() => {
this.noHandlePopup = !this.noHandlePopup
})
.bindPopup(this.noHandlePopup, {
-
- message: 'content content content ...',
+ message: 'content1 content1',
placementOnTop: false,
onStateChange: (e) => {
console.info(e.isVisible.toString())
@@ -68,18 +298,17 @@ struct PopupExample {
this.noHandlePopup = false
}
}
- })
+ })
+ .position({ x: 100, y: 50 })
Button('with handle popup')
.onClick(() => {
this.handlePopup = !this.handlePopup
})
.bindPopup(this.handlePopup, {
-
- message: 'content content content ...',
+ message: 'content2 content2',
placementOnTop: true,
- secondaryButton: {
-
+ primaryButton: {
value: 'ok',
action: () => {
this.handlePopup = !this.handlePopup
@@ -90,6 +319,25 @@ struct PopupExample {
console.info(e.isVisible.toString())
}
})
+ .position({ x: 100, y: 200 })
+
+ Button('custom popup')
+ .onClick(() => {
+ this.customPopup = !this.customPopup
+ })
+ .bindPopup(this.customPopup, {
+ builder: this.popupBuilder,
+ placement: Placement.Bottom,
+ maskColor: 0x33000000,
+ popupColor: Color.White,
+ enableArrow: true,
+ onStateChange: (e) => {
+ if (!e.isVisible) {
+ this.customPopup = false
+ }
+ }
+ })
+ .position({ x: 100, y: 350 })
}.width('100%').padding({ top: 5 })
}
}
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-response-region.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-response-region.md
new file mode 100644
index 0000000000000000000000000000000000000000..cf71d324e4ed22f3bee1ef83a1c8b57bb88c1339
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-response-region.md
@@ -0,0 +1,133 @@
+# Touch Target
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+You can set the touch target for components that support universal click events, touch events, and gestures.
+
+## Required Permissions
+
+None
+
+## Attributes
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+ responseRegion
+
+ Array<Rectangle> | Rectangle
+
+ {
+ x: 0,
+ y:0,
+ width:'100%',
+ height:'100%'
+ }
+
+ Indicates one or more touch targets, including their location and size.
+ NOTE: The percentage is measured relative to the component itself.
+
x and y can be set to a positive or negative percentage value. For example, when x is set to '100%' , the touch target is offset from the right edge of the component by the component's width. When x is set to '-100%' , the touch target is offset from the left edge of the component by the component's width. When y is set to '100%' , the touch target is offset from the bottom edge of the component by the component's height. When y is set to '-100%' , the touch target is offset from the top edge of the component by the component's height.
+
width and height can only be set to positive percentage values. For example, when width is set to '100%' , the width of the touch target is equal to that of the component; when height is set to '100%' , the height of the touch target is equal to that of the component.
+
+
+
+
+
+
+- Rectangle object
+
+
+ Name
+
+ Type
+
+ Mandatory
+
+ Default Value
+
+ Description
+
+
+
+ x
+
+ Length
+
+ No
+
+ 0vp
+
+ X coordinate of the touch point relative to the left edge of the component.
+
+
+ y
+
+ Length
+
+ No
+
+ 0vp
+
+ Y coordinate of the touch point relative to the left edge of the component.
+
+
+ width
+
+ Length
+
+ No
+
+ 100%
+
+ Width of the touch target.
+
+
+ height
+
+ Length
+
+ No
+
+ 100%
+
+ Height of the touch target.
+
+
+
+
+
+ >![](../../public_sys-resources/icon-note.gif) **NOTE:**
+ >When both **x** and **y** are set to positive values, the entire touch target offsets towards the lower right corner of the component. How much the touch target offsets is subject to the set values.
+
+
+## Example
+
+```
+@Entry
+@Component
+struct ResponseRegionExample {
+ build() {
+ Column() {
+ Toggle({ type: ToggleType.Checkbox, isOn: true })
+ .selectedColor(0x39a2db)
+ .backgroundColor(0xAFEEEE)
+ .responseRegion({ x: 1.0, y: 1.0, width: 400, height: 400 })
+ .onChange((isOn: boolean) => {
+ console.info('Component status:' + isOn)
+ })
+ }.width('100%').margin({ top: 5 })
+ }
+}
+```
+
+![](figures/gif1.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md
index c7e6118207a621fa1249937177060ae104533b31..0fb7dd4f8881ad4258e2d887e6a9004d0ce0cd16 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-sharp-clipping.md
@@ -1,4 +1,13 @@
-# Shape Clipping
+# Shape Clipping
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-size.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-size.md
index 74b58e40645efc6af9cdcc881928a341fb902128..dbac35d7acd691ff16880f42955607a30fb80f8b 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-size.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-size.md
@@ -1,11 +1,18 @@
-# Size
+# Size
-This topic describes the attributes used to set the component size.
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
- Name
+ Name
- Type
+ Type
Default Value
@@ -13,27 +20,27 @@ This topic describes the attributes used to set the component size.
- width
+ width
- Length
+ Length
-
Width of a component. By default, the width required to fully hold the component content is used.
- height
+ height
- Length
+ Length
-
Height of the component. By default, the height required to fully hold the component content is used.
- size
+ size
- {
+ {
width?: Length,
height?: Length
}
@@ -43,9 +50,9 @@ This topic describes the attributes used to set the component size.
Height and width of the component.
- padding
+ padding
- {
+ {
top?: Length,
right?: Length,
bottom?: Length,
@@ -58,9 +65,9 @@ This topic describes the attributes used to set the component size.
When the parameter is of the Length type, the four paddings take effect.
- margin
+ margin
- {
+ {
top?: Length,
right?: Length,
bottom?: Length,
@@ -74,13 +81,13 @@ This topic describes the attributes used to set the component size.
When the parameter is of the Length type, the four margins take effect.
- constraintSize
+ constraintSize
- {
+ {
minWidth?: Length,
maxWidth?: Length,
minHeight?: Length,
- maxHeight?: Length
+ maxHeight?: Lenght
}
{
@@ -93,9 +100,9 @@ This topic describes the attributes used to set the component size.
Constraint size of the component, which is used to limit the size range during component layout.
- layoutWeight
+ layoutWeight
- number
+ number
0
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md
index 225d274ceb309b91158e2a2e7ef57896e662cbd9..d793202b2815247310b306b50a98b2f835ed1ec5 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-text-style.md
@@ -1,7 +1,16 @@
-# Text Style
+# Text Style
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The attributes described in this topic are used to set the text style for a component that contains text.
+## Required Permissions
+
+None
+
+## Attributes
+
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-touchable.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-touchable.md
new file mode 100644
index 0000000000000000000000000000000000000000..b657f8645c805a602937716d43743016ee5fc99b
--- /dev/null
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-touchable.md
@@ -0,0 +1,65 @@
+# Click Control
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
+
+
+ Name
+
+ Type
+
+ Default Value
+
+ Description
+
+
+
+ touchable
+
+ boolean
+
+ true
+
+ Whether the current component is touchable.
+
+
+
+
+
+## Example
+
+```
+@Entry
+@Component
+struct TouchAbleExample {
+ @State text1: string = ''
+ @State text2: string = ''
+
+ build() {
+ Stack() {
+ Rect()
+ .fill(Color.Gray).width(150).height(150)
+ .onClick(() => {
+ console.info(this.text1 = 'Rect Clicked')
+ })
+ .overlay(this.text1, { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
+ Ellipse()
+ .fill(Color.Pink).width(150).height(80)
+ .touchable(false) // When the Ellipse area is touched, the message "Ellipse Clicked" is not displayed.
+ .onClick(() => {
+ console.info(this.text2 = 'Ellipse Clicked')
+ })
+ .overlay(this.text2, { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
+ }.margin(100)
+ }
+}
+```
+
+![](figures/gif2.gif)
+
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md
index 6f9ba8247b8b3d3a975a9e777471a17c5f1fe985..10ced26c5df07aa57727c633231be1d7bbb90f55 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md
@@ -1,4 +1,13 @@
-# Transformation
+# Transformation
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
@@ -125,5 +134,5 @@ struct TransformExample {
}
```
-![](figures/1111-59.png)
+![](figures/1111.png)
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md
index 0e5ad66ef588156f5bdb35c8197ad144647eadd7..0d1e059339f91505df8d52c44d6e517bffb9f148 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md
@@ -1,4 +1,13 @@
-# Visibility
+# Visibility
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md
index 5ee46c6c64bb6a072d19f3faac63f84eba13a775..91770cb64ef08cd8209c9ce6d9969d708ebd9f3b 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md
@@ -1,4 +1,13 @@
-# Z-order Control
+# Z-order Control
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This attribute is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Attributes
Name
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes.md
index 08bf3e67b96e2c69e76085148be87c197f3f15f7..2ca2f7ebdbf19b813cdaf4894ab13bb8eb2172f4 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-attributes.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes.md
@@ -1,4 +1,4 @@
-# Universal Attributes
+# Universal Attributes
- **[Size](ts-universal-attributes-size.md)**
@@ -38,4 +38,8 @@
- **[Menu Control](ts-universal-attributes-menu.md)**
+- **[Click Control](ts-universal-attributes-touchable.md)**
+
+- **[Touch Target](ts-universal-attributes-response-region.md)**
+
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-components.md b/en/application-dev/reference/arkui-ts/ts-universal-components.md
index 7676e5c027a3065f1704b74c2dae162a131f9c07..3a70c3c421034a7cba1e10b40c8f557ad143f8ce 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-components.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-components.md
@@ -1,4 +1,4 @@
-# Universal Components
+# Universal Components
- **[Universal Events](ts-universal-events.md)**
diff --git a/en/application-dev/reference/arkui-ts/ts-universal-events-click.md b/en/application-dev/reference/arkui-ts/ts-universal-events-click.md
index 323f9a44069b8e6cb2fe35871b820bfd8b61b5f7..8ac56eb6bba732d3e9780113361fe4775b4723cb 100644
--- a/en/application-dev/reference/arkui-ts/ts-universal-events-click.md
+++ b/en/application-dev/reference/arkui-ts/ts-universal-events-click.md
@@ -1,4 +1,13 @@
-# Click Event
+# Click Event
+
+>![](../../public_sys-resources/icon-note.gif) **NOTE:**
+>This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
+
+## Required Permissions
+
+None
+
+## Events