diff --git a/zh-cn/application-dev/reference/apis/js-apis-animator.md b/zh-cn/application-dev/reference/apis/js-apis-animator.md index b8c7db9204ff2d698da536c69a1836e33300b1fa..12c3103acfdc89c237cad32d6125caaa6ab350c6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-animator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-animator.md @@ -257,7 +257,7 @@ animatorResult.onrepeat = function() { | 名称 | 类型 | 必填 | 说明 | | ---------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | | duration | number | 是 | 动画播放的时长,单位毫秒。 | -| easing | string | 是 | 动画插值曲线,仅支持以下可选值:
"linear":动画线性变化。
"ease":动画开始和结束时的速度较慢,cubic-bezier(0.25、0.1、0.25、1.0)。
"ease-in":动画播放速度先慢后快,cubic-bezier(0.42, 0.0, 1.0, 1.0)。
"ease-out":动画播放速度先快后慢,cubic-bezier(0.0, 0.0, 0.58, 1.0)。
"ease-in-out":动画播放速度先加速后减速,cubic-bezier(0.42, 0.0, 0.58, 1.0)。
"fast-out-slow-in":标准曲线,cubic-bezier(0.4,0.0,0.2,1.0)。
"linear-out-slow-in":减速曲线,cubic-bezier(0.0,0.0,0.2,1.0)。
"friction":阻尼曲线,cubic-bezier(0.2, 0.0, 0.2, 1.0)。
"extreme-deceleration":急缓曲线,cubic-bezier(0.0, 0.0, 0.0, 1.0)。
"rhythm":节奏曲线,cubic-bezier(0.7, 0.0, 0.2, 1.0)。
"sharp":锐利曲线,cubic-bezier(0.33, 0.0, 0.67, 1.0)。
"smooth":平滑曲线,cubic-bezier(0.4, 0.0, 0.4, 1.0)。
cubic-bezier(x1, y1, x2, y2):在三次贝塞尔函数中定义动画变化过程,入参的值必须处于0-1之间。
steps(number, step-position):阶梯曲线。number必须设置,支持的类型为int。step-position参数可选,支持设置start或end,默认值为end。 | +| easing | string | 是 | 动画插值曲线,仅支持以下可选值:
"linear":动画线性变化。
"ease":动画开始和结束时的速度较慢,cubic-bezier(0.25、0.1、0.25、1.0)。
"ease-in":动画播放速度先慢后快,cubic-bezier(0.42, 0.0, 1.0, 1.0)。
"ease-out":动画播放速度先快后慢,cubic-bezier(0.0, 0.0, 0.58, 1.0)。
"ease-in-out":动画播放速度先加速后减速,cubic-bezier(0.42, 0.0, 0.58, 1.0)。
"fast-out-slow-in":标准曲线,cubic-bezier(0.4,0.0,0.2,1.0)。
"linear-out-slow-in":减速曲线,cubic-bezier(0.0,0.0,0.2,1.0)。
"friction":阻尼曲线,cubic-bezier(0.2, 0.0, 0.2, 1.0)。
"extreme-deceleration":急缓曲线,cubic-bezier(0.0, 0.0, 0.0, 1.0)。
"rhythm":节奏曲线,cubic-bezier(0.7, 0.0, 0.2, 1.0)。
"sharp":锐利曲线,cubic-bezier(0.33, 0.0, 0.67, 1.0)。
"smooth":平滑曲线,cubic-bezier(0.4, 0.0, 0.4, 1.0)。
"cubic-bezier(x1,y1,x2,y2)":三次贝塞尔曲线,x1、x2的值必须处于0-1之间。例如"cubic-bezier(0.42,0.0,0.58,1.0)"。
"steps(number,step-position)":阶梯曲线,number必须设置,为正整数,step-position参数可选,支持设置start或end,默认值为end。例如"steps(3,start)"。 | | delay | number | 是 | 动画延时播放时长,单位毫秒,设置为0时,表示不延时。 | | fill | "none" \| "forwards" \| "backwards" \| "both" | 是 | 动画执行后是否恢复到初始状态,动画执行后,动画结束时的状态(在最后一个关键帧中定义)将保留。
"none":在动画执行之前和之后都不会应用任何样式到目标上。
"forwards":在动画结束后,目标将保留动画结束时的状态(在最后一个关键帧中定义)。
"backwards":动画将在animation-delay期间应用第一个关键帧中定义的值。当animation-direction为"normal"或"alternate"时应用from关键帧中的值,当animation-direction为"reverse"或"alternate-reverse"时应用to关键帧中的值。
"both":动画将遵循forwards和backwards的规则,从而在两个方向上扩展动画属性。 | | direction | "normal" \| "reverse" \| "alternate" \| "alternate-reverse" | 是 | 动画播放模式。
"normal": 动画正向循环播放。
"reverse": 动画反向循环播放。
"alternate":动画交替循环播放,奇数次正向播放,偶数次反向播放。
"alternate-reverse":动画反向交替循环播放,奇数次反向播放,偶数次正向播放。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-curve.md b/zh-cn/application-dev/reference/apis/js-apis-curve.md index 9172b5325d79a8137dbda13292f3d81b3e2c0c7b..8b4bc5f92e324a09621a44792bb51901577fc3a5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-curve.md +++ b/zh-cn/application-dev/reference/apis/js-apis-curve.md @@ -78,7 +78,7 @@ stepsCurve(count: number, end: boolean): ICurve | 参数名 | 类型 | 必填 | 说明 | | ------ | ------- | ----| ------------------------------------------------------------ | -| count | number | 是 | 阶梯的数量,需要为正整数。
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按值为0处理。 | +| count | number | 是 | 阶梯的数量,需要为正整数。
取值范围:[1, +∞)
**说明:**
设置小于1的值时,按值为1处理。 | | end | boolean | 是 | 在每个间隔的起点或是终点发生阶跃变化。
-true:在终点发生阶跃变化。
-false:在起点发生阶跃变化。 | **返回值:** @@ -174,7 +174,7 @@ springMotion(response?: number, dampingFraction?: number, overlapDuration?: numb | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ----- | | response | number | 否 | 弹簧自然振动周期,决定弹簧复位的速度。
默认值:0.55
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.55处理。 | -| dampingFraction | number | 否 | 阻尼系数。
0表示无阻尼,一直处于震荡状态;
大于0小于1的值为欠阻尼,运动过程中会超出目标值;
等于1为临界阻尼;
大于1为过阻尼,运动过程中逐渐趋于目标值。
默认值:0.825
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.55处理。 | +| dampingFraction | number | 否 | 阻尼系数。
0表示无阻尼,一直处于震荡状态;
大于0小于1的值为欠阻尼,运动过程中会超出目标值;
等于1为临界阻尼;
大于1为过阻尼,运动过程中逐渐趋于目标值。
默认值:0.825
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.825处理。 | | overlapDuration | number | 否 | 弹性动画衔接时长。发生动画继承时,如果前后两个弹性动画response不一致,response参数会在overlapDuration时间内平滑过渡。
默认值:0
单位:秒
取值范围:[0, +∞)。
**说明:**
设置小于0的值时,按默认值0处理。
弹性动画曲线为物理曲线,[animation](../arkui-ts/ts-animatorproperty.md)、[animateTo](../arkui-ts/ts-explicit-animation.md)中的duration参数不生效,动画持续时间取决于springMotion动画曲线参数和之前的速度。时间不能归一,故不能通过该曲线的interpolate函数获得插值。 | @@ -237,10 +237,10 @@ interpolatingSpring(velocity: number, mass: number, stiffness: number, damping: **参数:** | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ----- | -| velocity | number | 是 | 初始速度。外部因素对弹性动效产生的影响参数,目的是保证对象从之前的运动状态平滑地过渡到弹性动效。该速度是归一化速度,其值等于动画开始时的实际速度除以动画属性改变值。 | -| mass | number | 是 | 质量。弹性系统的受力对象,会对弹性系统产生惯性影响。质量越大,震荡的幅度越大,恢复到平衡位置的速度越慢。 | -| stiffness | number | 是 | 刚度。表示物体抵抗施加的力而形变的程度。刚度越大,抵抗变形的能力越强,恢复到平衡位置的速度越快。 | -| damping | number | 是 | 阻尼。是一个纯数,无真实的物理意义,用于描述系统在受到扰动后震荡及衰减的情形。阻尼越大,弹性运动的震荡次数越少、震荡幅度越小。 | +| velocity | number | 是 | 初始速度。外部因素对弹性动效产生的影响参数,目的是保证对象从之前的运动状态平滑地过渡到弹性动效。该速度是归一化速度,其值等于动画开始时的实际速度除以动画属性改变值。
取值范围:(-∞, +∞) | +| mass | number | 是 | 质量。弹性系统的受力对象,会对弹性系统产生惯性影响。质量越大,震荡的幅度越大,恢复到平衡位置的速度越慢。
取值范围:(0, +∞)
**说明:**
设置的值小于0时,按1处理。 | +| stiffness | number | 是 | 刚度。表示物体抵抗施加的力而形变的程度。刚度越大,抵抗变形的能力越强,恢复到平衡位置的速度越快。
取值范围:(0, +∞)
**说明:**
设置的值小于0时,按1处理。 | +| damping | number | 是 | 阻尼。是一个纯数,无真实的物理意义,用于描述系统在受到扰动后震荡及衰减的情形。阻尼越大,弹性运动的震荡次数越少、震荡幅度越小。
取值范围:(0, +∞)
**说明:**
设置的值小于0时,按1处理。 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-matrix4.md b/zh-cn/application-dev/reference/apis/js-apis-matrix4.md index 5600a5521366ff4bb9bd2c578d8222e28d681d62..9cd9ee889ea6dd9f31f196fbe6ed37fb73e6320d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-matrix4.md +++ b/zh-cn/application-dev/reference/apis/js-apis-matrix4.md @@ -150,6 +150,7 @@ import matrix4 from '@ohos.matrix4' @Component struct Test { private matrix1 = matrix4.identity().translate({ x: 100 }) + // 对matrix1的拷贝矩阵做scale操作,不影响到matrix1 private matrix2 = this.matrix1.copy().scale({ x: 2 }) build() { @@ -305,7 +306,7 @@ Matrix的坐标点转换函数,可以将当前的变换效果作用到一个 combine(options: Matrix4Transit): Matrix4Transit -Matrix的叠加函数,可以将两个矩阵的效果叠加起来生成一个新的矩阵对象。 +Matrix的叠加函数,可以将两个矩阵的效果叠加起来生成一个新的矩阵对象。会改变调用该函数的原始矩阵。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -330,8 +331,8 @@ import matrix4 from '@ohos.matrix4' @Entry @Component struct Test { - private matrix1 = matrix4.identity().translate({ x: 200 }).copy() - private matrix2 = matrix4.identity().scale({ x: 2 }).copy() + private matrix1 = matrix4.identity().translate({ x: 200 }) + private matrix2 = matrix4.identity().scale({ x: 2 }) build() { Column() { @@ -342,7 +343,7 @@ struct Test { .margin({ top: 50 }) // 先平移x轴200px,再缩放两倍x轴,得到矩阵变换后的效果图 Image($r("app.media.icon")) - .transform(this.matrix1.combine(this.matrix2)) + .transform(this.matrix1.copy().combine(this.matrix2)) .width("40%") .height(100) .margin({ top: 50 }) @@ -358,7 +359,7 @@ struct Test { invert(): Matrix4Transit -Matrix的逆函数,可以返回一个当前矩阵对象的逆矩阵,即效果正好相反。 +Matrix的逆函数,可以返回一个当前矩阵对象的逆矩阵,即效果正好相反。会改变调用该函数的原始矩阵。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -374,7 +375,7 @@ Matrix的逆函数,可以返回一个当前矩阵对象的逆矩阵,即效 import matrix4 from '@ohos.matrix4' // matrix1(宽放大2倍) 和 matrix2(宽缩小2倍) 效果相反 let matrix1 = matrix4.identity().scale({ x: 2 }) -let matrix2 = matrix1.invert() +let matrix2 = matrix1.copy().invert() @Entry @Component @@ -401,7 +402,7 @@ struct Tests { translate(options: TranslateOption): Matrix4Transit -Matrix的平移函数,可以为当前矩阵增加x轴/y轴/z轴平移效果。 +Matrix的平移函数,可以为当前矩阵增加x轴/y轴/z轴平移效果。会改变调用该函数的原始矩阵。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -446,7 +447,7 @@ struct Test { scale(options: ScaleOption): Matrix4Transit -Matrix的缩放函数,可以为当前矩阵增加x轴/y轴/z轴缩放效果。 +Matrix的缩放函数,可以为当前矩阵增加x轴/y轴/z轴缩放效果。会改变调用该函数的原始矩阵。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -490,7 +491,7 @@ struct Test { rotate(options: RotateOption): Matrix4Transit -Matrix的旋转函数,可以为当前矩阵增加x轴/y轴/z轴旋转效果。 +Matrix的旋转函数,可以为当前矩阵增加x轴/y轴/z轴旋转效果。会改变调用该函数的原始矩阵。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full @@ -604,9 +605,9 @@ struct Test { | 名称 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ------------------------------------------------------------ | -| x | number | 否 | x轴的缩放倍数。x>1时以x轴方向放大,x<1时以x轴方向缩小。
默认值:1
取值范围 [0, +∞)
**说明:**
设置小于0的值时,按照默认值处理。 | -| y | number | 否 | y轴的缩放倍数。y>1时以y轴方向放大,y<1时以y轴方向缩小。
默认值:1
取值范围 [0, +∞)
**说明:**
设置小于0的值时,按照默认值处理。 | -| z | number | 否 | z轴的缩放倍数。z>1时以z轴方向放大,z<1时以z轴方向缩小。
默认值:1
取值范围 [0, +∞)
**说明:**
设置小于0的值时,按照默认值处理。 | +| x | number | 否 | x轴的缩放倍数。x>1时以x轴方向放大,0<x<1时以x轴方向缩小,x<0时沿x轴反向并缩放。
默认值:1
取值范围 (-∞, +∞) | +| y | number | 否 | y轴的缩放倍数。y>1时以y轴方向放大,0<y<1时以y轴方向缩小,y<0时沿y轴反向并缩放。
默认值:1
取值范围 (-∞, +∞) | +| z | number | 否 | z轴的缩放倍数。z>1时以z轴方向放大,0<z<1时以z轴方向缩小,z<0时沿z轴反向并缩放。
默认值:1
取值范围 (-∞, +∞) | | centerX | number | 否 | 变换中心点x轴坐标。
默认值:0。
取值范围 (-∞, +∞) | | centerY | number | 否 | 变换中心点y轴坐标。
默认值:0。
取值范围 (-∞, +∞) | @@ -616,9 +617,9 @@ struct Test { | 名称 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ------------------------------------------------------- | -| x | number | 否 | 旋转轴向量x坐标。
默认值:1。
取值范围 (-∞, +∞) | -| y | number | 否 | 旋转轴向量y坐标。
默认值:1。
取值范围 (-∞, +∞) | -| z | number | 否 | 旋转轴向量z坐标。
默认值:1。
取值范围 (-∞, +∞) | +| x | number | 否 | 旋转轴向量x坐标。
默认值:0。
取值范围 (-∞, +∞) | +| y | number | 否 | 旋转轴向量y坐标。
默认值:0。
取值范围 (-∞, +∞) | +| z | number | 否 | 旋转轴向量z坐标。
默认值:0。
取值范围 (-∞, +∞)。
**说明:** 旋转向量中x、y、z至少有一个不为0才有意义。 | | angle | number | 否 | 旋转角度。
默认值:0 | | centerX | number | 否 | 变换中心点x轴坐标。
默认值:0 | | centerY | number | 否 | 变换中心点y轴坐标。
默认值:0 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md b/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md index 0a7776d01bd030d9fcebd530b0636c80736b3150..0b1c6a67f96470e83ec9928c578b573e8ac5210b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md @@ -16,7 +16,7 @@ animation(value: {duration?: number, tempo?: number, curve?: string | Curve | IC | ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ | | duration | number | 否 | 设置动画时长。
默认值:1000
单位:毫秒
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
- 在ArkTS卡片上最大动画持续时间为1000毫秒。
- 设置小于0的值时按0处理。
- 设置浮点型类型的值时,向下取整。例如,设置值为1.2,按照1处理。 | | tempo | number | 否 | 动画播放速度。数值越大,动画播放速度越快,数值越小,播放速度越慢。
值为0时,表示不存在动画。
默认值:1
**说明:**
当设置小于0的值时按值为1处理。 | -| curve | string \| [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve)9+ | 否 | 设置动画曲线。默认曲线为线性。
默认值:Curve.Linear
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| curve | string \| [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve)9+ | 否 | 设置动画曲线。
默认值:Curve.EaseInOut
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | delay | number | 否 | 设置动画延迟执行的时长。单位为毫秒,默认不延时播放。
默认值:0
取值范围:[0, +∞)
**说明:**
- 当设置的值小于0时按0处理。
- 设置浮点型类型的值时,向下取整。例如,设置值为1.2,按照1处理。 | | iterations | number | 否 | 设置播放次数。
默认值:1
取值范围:[-1, +∞)
**说明:**
设置为-1时表示无限次播放。设置为0时表示无动画效果。 | | playMode | [PlayMode](ts-appendix-enums.md#playmode) | 否 | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。
相关使用约束请参考PlayMode说明。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md b/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md index 79155e03375271324c332f438feb385a7eec7a28..eb891e4848d5c25aace39a40ec56b2f0308569bf 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md @@ -25,7 +25,7 @@ animateTo(value: AnimateParam, event: () => void): void | -------- | -------- | -------- | | duration | number | 动画持续时间,单位为毫秒。
默认值:1000
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
- 在ArkTS卡片上最大动画持续时间为1000毫秒,若超出则固定为1000毫秒。
- 设置小于0的值时按0处理。
- 设置浮点型类型的值时,向下取整。例如,设置值为1.2,按照1处理。 | | tempo | number | 动画的播放速度,值越大动画播放越快,值越小播放越慢,为0时无动画效果。
默认值:1.0
**说明:**
当设置小于0的值时按值为1处理。 | -| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | 动画曲线。
默认值:Curve.Linear
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | 动画曲线。
默认值:Curve.EaseInOut
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | delay | number | 单位为ms(毫秒),默认不延时播放。
默认值:0
**说明:**
- 当设置的值小于0时按0处理。
- 设置浮点型类型的值时,向下取整。例如,设置值为1.2,按照1处理。 | | iterations | number | 默认播放一次,设置为-1时表示无限次播放。
默认值:1 | | playMode | [PlayMode](ts-appendix-enums.md#playmode) | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。
相关使用约束请参考PlayMode说明。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md b/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md index 3c4242aa7b50640606c83bea7ecd29f3a3092f04..8a778e5a327c60f402c585f301904a877895a14d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md @@ -9,9 +9,9 @@ ## 属性 -| 名称 | 参数类型 | 默认值 | 描述 | -| -------- | -------- | -------- | -------- | -| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
} | {
'',
0.0,
1.0,
false
} | 设置组件的运动路径,入参说明如下:
- path:位移动画的运动路径,使用svg路径字符串。path中支持使用start和end进行起点和终点的替代,如:'Mstart.x start.y L50 50 Lend.x end.y Z',更多说明请参考[绘制路径](../../ui/ui-js-components-svg-path.md)。
- from:运动路径的起点。
默认值:0.0
取值范围:[0, 1]
设置小于0或大于1的值时,按默认值0处理。
- to:运动路径的终点。
默认值:1.0
取值范围:[0, 1]
设置小于0或大于1的值时,按默认值1处理,且满足to值 >= 异常值处理后的from值。
- rotatable:是否跟随路径进行旋转。 | +| 名称 | 参数类型 | 描述 | +| -------- | -------- | -------- | +| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
} | 设置组件的运动路径,入参说明如下:
- path:位移动画的运动路径,使用svg路径字符串。path中支持使用start和end进行起点和终点的替代,如:'Mstart.x start.y L50 50 Lend.x end.y Z',更多说明请参考[绘制路径](../../ui/ui-js-components-svg-path.md)。
设置为空字符串时相当于不设置路径动画。
- from:运动路径的起点。
默认值:0.0
取值范围:[0, 1]
设置小于0或大于1的值时,按默认值0处理。
- to:运动路径的终点。
默认值:1.0
取值范围:[0, 1]
设置小于0或大于1的值时,按默认值1处理,且满足to值 >= 异常值处理后的from值。
- rotatable:是否跟随路径进行旋转。
默认值:false | ## 示例