> Universal events are supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
## Event Description
- Events are bound to components. When a component meets the event triggering condition, the corresponding event callback in the JS is executed to implement the interaction between the UI and the JS logic layer of the page.
- The event callback can carry additional information through parameters, such as the dataset on the component and event-specific callback parameters.
Different from private events, universal events can be bound to most components.
| Name | Parameter | Description | Support Bubbling |
| touchstart | [TouchEvent](js-components-common-events.md) | Triggered when the tapping starts. | Yes<sup>5+</sup> |
| touchmove | [TouchEvent](js-components-common-events.md) | Triggered when the tapping moves. | Yes<sup>5+</sup> |
| touchcancel | [TouchEvent](js-components-common-events.md) | Triggered when the tapping is interrupted. | Yes<sup>5+</sup> |
| touchend | [TouchEvent](js-components-common-events.md) | Triggered when the tapping ends. | Yes<sup>5+</sup> |
| click | - | Triggered when a component is clicked. | Yes<sup>6+</sup> |
| doubleclick<sup>7+</sup> | | Triggered when a component is double-clicked. | No |
| longpress | - | Triggered when a component is long pressed. | No |
| swipe<sup>5+</sup> | [SwipeEvent](js-components-common-events.md#table111811577714) | Triggered when a user quickly swipes on a component. | No |
| attached<sup>6+</sup> | - | Triggered after the current component node is mounted to the render tree. | No |
| detached<sup>6+</sup> | - | Triggered when the current component node is removed from the render tree. | No |
| pinchstart<sup>7+</sup> | [PinchEvent](js-components-common-events.md) | Triggered when a pinch operation is started. | No |
| pinchupdate<sup>7+</sup> | [PinchEvent](js-components-common-events.md) | Triggered when a pinch operation is in progress. | No |
| pinchend<sup>7+</sup> | [PinchEvent](js-components-common-events.md) | Triggered when a pinch operation is ended. | No |
| pinchcancel<sup>7+</sup> | [PinchEvent](js-components-common-events.md) | Triggered when the pinch operation is interrupted. | No |
| dragstart<sup>7+</sup> | [DragEvent](js-components-common-events.md) | Triggered when dragging starts. | No |
| drag<sup>7+</sup> | [DragEvent](js-components-common-events.md) | Triggered when dragging is in progress. | No |
| dragend<sup>7+</sup> | [DragEvent](js-components-common-events.md) | Triggered when dragging is ended. | No |
| dragenter<sup>7+</sup> | [DragEvent](js-components-common-events.md) | Triggered when the dragged component enters a drop target. | No |
| dragover<sup>7+</sup> | [DragEvent](js-components-common-events.md) | Triggered when the dragged component is being dragged over a drop target. | No |
| dragleave<sup>7+</sup> | [DragEvent](js-components-common-events.md) | Triggered when the dragged component leaves a drop target. | No |
| drop<sup>7+</sup> | [DragEvent](js-components-common-events.md) | Triggered when a component is dropped on a drop target. | No |
>  **NOTE:** Events not listed in the preceding table are non-bubbling events, such as the [change event](js-components-basic-input.md). For details, see the specific component.
| touches | Array\<TouchInfo> | Attribute set of the touch event, including the information array of the touch points on the screen. |
| changedTouches | Array\<TouchInfo> | Attribute set when a touch event occurs, including the information array of changed touch points on the screen. **changedTouches** has the same data format as **touches** and indicates touch point changes, such as from no touch point to newly generated touch points, from some touch points to no touch point, and location changes. For example, when the user's finger leaves the touchscreen, no data exists in the **touches** array, but **changedTouches** will save the generated data. |
| Name | Parameter | Description | Support Bubbling |
| touchstart | TouchEvent | Triggered when the tapping starts. For details about **TouchEvent**, see Table 2. | Yes<sup>5+</sup> |
| touchmove | TouchEvent | Triggered when the tapping moves. | Yes<sup>5+</sup> |
| touchcancel | TouchEvent | Triggered when the tapping is interrupted. | Yes<sup>5+</sup> |
| touchend | TouchEvent | Triggered when the tapping ends. | Yes<sup>5+</sup> |
| click | - | Triggered when a component is clicked. | Yes<sup>6+</sup> |
| doubleclick<sup>7+</sup> | - | Triggered when a component is double-clicked. | No<br>Bubbling is supported since API version 9. |
| longpress | - | Triggered when a component is long pressed. | No<br>Bubbling is supported since API version 9.|
| swipe<sup>5+</sup> | SwipeEvent | Triggered when a user quickly swipes on a component.<br/>For details about **SwipeEvent**, see Table 4. | No<br>Bubbling is supported since API version 9.|
| attached<sup>6+</sup> | - | Triggered after the current component node is mounted to the render tree. | No |
| detached<sup>6+</sup> | - | Triggered when the current component node is removed from the render tree. | No |
| pinchstart<sup>7+</sup> | PinchEvent | Triggered when a pinch operation is started.<br>For details about **PinchEvent**, see Table 5.| No |
| pinchupdate<sup>7+</sup> | PinchEvent | Triggered when a pinch operation is in progress. | No |
| pinchend<sup>7+</sup> | PinchEvent | Triggered when a pinch operation is ended. | No |
| pinchcancel<sup>7+</sup> | PinchEvent | Triggered when a pinch operation is interrupted. | No |
| dragstart<sup>7+</sup> | DragEvent | Triggered when dragging starts.<br>For details about **DragEvent**, see Table 6. | No |
| drag<sup>7+</sup> | DragEvent | Triggered when dragging is in progress. | No |
| dragend<sup>7+</sup> | DragEvent | Triggered when dragging is ended. | No |
| dragenter<sup>7+</sup> | DragEvent | Triggered when the dragged component enters a drop target. | No |
| dragover<sup>7+</sup> | DragEvent | Triggered when the dragged component is being dragged over a drop target. | No |
| dragleave<sup>7+</sup> | DragEvent | Triggered when the dragged component leaves a drop target. | No |
| drop<sup>7+</sup> | DragEvent | Triggered when the dragged component is dropped on a drop target. | No |
> **NOTE**<br>
> Events not listed in the preceding table do not support bubbling, such as the [change event](../arkui-js/js-components-basic-input.md#events) of the **<input\>** component. For details, see the description of the specific component.
| touches | Array<TouchInfo> | Attribute set of the touch event, including the information array of the touch points on the screen. |
| changedTouches | Array<TouchInfo> | Attribute set when a touch event occurs, including the information array of changed touch points on the screen. **changedTouches** has the same data format as **touches** and indicates touch point changes, including changes in the number and location of touch points. For example, when the user's finger leaves the screen, which means that the number of touch points changes from 1 to 0, **changedTouches** has the relevant data generated, but not **touches**.|
| globalX | number | Horizontal distance from the upper left corner of the screen (excluding the status bar), which acts as the origin of coordinates.|
| globalY | number | Vertical distance from the upper left corner of the screen (excluding the status bar), which acts as the origin of coordinates.|
| localX | number | Horizontal distance from the upper left corner of the touched component, which acts as the origin of coordinates. |
| localY | number | Vertical distance from the upper left corner of the touched component, which acts as the origin of coordinates. |
| globalX | number | Horizontal distance from the upper left corner of the screen (excluding the status bar). The upper left corner of the screen acts as the coordinate origin. |
| globalY | number | Vertical distance from the upper left corner of the screen (excluding the status bar). The upper left corner of the screen acts as the coordinate origin. |
| localX | number | Horizontal distance from the upper left corner of the touched component. The upper left corner of the component acts as the coordinate origin. |
| localY | number | Vertical distance from the upper left corner of the touched component. The upper left corner of the component acts as the coordinate origin. |
| size | number | Touch area. |
| force<sup>6+</sup> | number | Touch force. |
**Table 4** Attributes of the SwipeEvent object (inherited from BaseEvent)
| direction | string | Swiping direction. The value can be one of the following:<br>- **left**: Swipe left.<br>- **right**: Swipe right.<br>- **up**: Swipe up.<br>- **down**: Swipe down.|
| distance<sup>6+</sup> | number | Swiping distance in the swiping direction. |
**Table 5** PinchEvent<sup>7+</sup>
| Attribute | Type | Description |
| ------------ | ------ | -------------- |
| scale | number | Scale factor. |
| pinchCenterX | number | X-coordinate of the pinch center, in px.|
| pinchCenterY | number | Y-coordinate of the pinch center, in px.|
| direction | string | Swiping direction. The value can be one of the following: <br>- **left**: Swipe from right to left <br>- **right**: Swipe from left to right <br>- **up**: Swipe upwards <br>- **down**: Swipe downwards |
| distance<sup>6+</sup> | number | Swiping distance in the swiping direction. |
**Table 6** DragEvent<sup>7+</sup> (inherited from BaseEvent)
**Table 5** Attributes of the PinchEvent object<sup>7+</sup>
| globalX | number | Horizontal distance from the origin of the coordinates in the upper left corner of the screen. |
| globalY | number | Vertical distance from the origin of the coordinates in the upper left corner of the screen. |
| timestamp | number | Timestamp. |
## Event Object
## Target<sup>6+</sup>
When a component triggers an event, the event callback receives an event object by default. You can obtain the corresponding information through the event object.
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
The **<ImageAnimator>** 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.
The **\<ImageAnimator>** 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
...
...
@@ -15,7 +15,7 @@ None
## Child Components
None
Not supported
## APIs
...
...
@@ -37,7 +37,7 @@ ImageAnimator()
| iterations | number | 1 | No | By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times. |
- AnimationStatus enums
| Name | Description |
| Name | Description |
| -------- | -------- |
| Initial | The animation is in the initial state. |
| Running | The animation is being played. |
...
...
@@ -45,7 +45,7 @@ ImageAnimator()
| Stopped | The animation is stopped. |
- FillMode enums
| Name | Description |
| Name | Description |
| -------- | -------- |
| None | After the playback is complete, the animation restores to the initial state. |
| Forwards | After the playback is complete, the animation remains in the end state. |
...
...
@@ -78,6 +78,7 @@ struct ImageAnimatorExample {
ImageAnimator()
.images([
{
// The comment folder is at the same level as the pages folder.
> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
> **NOTE**<br>The APIs of this module are 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.
| [imageSmoothingEnabled](#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'**. |
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.
> 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
...
...
@@ -1708,7 +1742,8 @@ Defines a transformation matrix. To transform a graph, you only need to set para
- Example
```
```ts
// xxx.ets
@Entry
@Component
structTransform{
...
...
@@ -1761,7 +1796,8 @@ Resets the existing transformation matrix and creates a new transformation matri
- Example
```
```ts
// xxx.ets
@Entry
@Component
structSetTransform{
...
...
@@ -1807,7 +1843,8 @@ Moves the origin of the coordinate system.
- Example
```
```ts
// xxx.ets
@Entry
@Component
structTranslate{
...
...
@@ -1839,18 +1876,18 @@ Moves the origin of the coordinate system.