diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/coordinates.png b/zh-cn/application-dev/reference/arkui-ts/figures/coordinates.png new file mode 100644 index 0000000000000000000000000000000000000000..a975e862118c6048cec5981049a5df160444540b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/coordinates.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md index 648f16c3e6166c41a15204f6587ba5c4ad162001..66b57b392bd0245ba0a022a2608d40bc6d96ce87 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md @@ -9,13 +9,16 @@ ## 属性 -| 名称 | 参数类型 | 描述 | -| --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| rotate | {
x?: number,
y?: number,
z?: number,
angle: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | (x, y, z)指定一个矢量,表示旋转轴,正角度为顺时针转动,负角度为逆时针转动,默认值为0,同时可以通过centerX和centerY设置旋转的中心点。
默认值:
{
x: 0,
y: 0,
z: 0,
angle: 0,
centerX: '50%',
centerY: '50%'
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | -| translate | {
x?: number \| string,
y?: number \| string,
z? : number \| string
} | 可以分别设置X轴、Y轴、Z轴的平移距离,距离的正负控制平移的方向。不支持百分比形式的输入。
默认值:
{
x: 0,
y: 0,
z: 0
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| 名称 | 参数类型 | 描述 | +| --------- | ---------------------------------------- | ---------------------------------------- | +| rotate | {
x?: number,
y?: number,
z?: number,
angle: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | 可使组件在以组件左上角为坐标原点的坐标系中进行旋转(坐标系如下图所示)。其中,(x, y, z)指定一个矢量,作为旋转轴。
- angle:旋转角度。取值为正时相对于旋转轴方向顺时针转动,取值为负时相对于旋转轴方向逆时针转动。取值可为string类型,如'90deg'。
- centerX和centerY用于指定旋转的中心点。
旋转轴和旋转中心点都基于坐标系设定,组件发生位移时,坐标系不会随之移动。
默认值:
{
x: 0,
y: 0,
z: 0,
angle: 0,
centerX: '50%',
centerY: '50%'
}
![coordinates](figures/coordinates.png)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| translate | {
x?: number \| string,
y?: number \| string,
z? : number \| string
} | 可使组件在以组件左上角为坐标原点的坐标系中进行移动(坐标系如下图所示)。其中,x,y,z的值分别表示在对应轴移动的距离,值为正时表示向对应轴的正向移动,值为负时表示向对应轴的反向移动。移动距离支持数字和字符串(比如'10px',‘10%’)两种类型。
默认值:
{
x: 0,
y: 0,
z: 0
}
![coordinates](figures/coordinates.png)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | scale | {
x?: number,
y?: number,
z?: number,
centerX?: number \| string,
centerY?: number \| string
} | 可以分别设置X轴、Y轴、Z轴的缩放比例,默认值为1,同时可以通过centerX和centerY设置缩放的中心点。
默认值:
{
x: 1,
y: 1,
z: 1,
centerX:'50%',
centerY:'50%'
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | -| transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | 设置当前组件的变换矩阵。 | +| transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | 设置当前组件的变换矩阵。 | +> **说明:** +> +> 当组件同时设置了rotate和scale属性时,centerX和centerY的取值会发生冲突,此时centerX和centerY的值以后设定属性的值为准。 ## 示例