From c19e5514ad55d7270c6faf85ace2c7debf594587 Mon Sep 17 00:00:00 2001 From: lanyill Date: Wed, 1 Jun 2022 16:31:42 +0800 Subject: [PATCH 1/2] =?UTF-8?q?ArkUI=E3=80=91=E3=80=90API9=E3=80=91Interpo?= =?UTF-8?q?late=E6=8E=A5=E5=8F=A3=E4=B8=8D=E5=8F=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lanyill Change-Id: Idc43ff599102efb3b9f36aa95acbc673420dc4a6 --- api/@ohos.curves.d.ts | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/api/@ohos.curves.d.ts b/api/@ohos.curves.d.ts index e3a377d6ce..57d03e20a4 100644 --- a/api/@ohos.curves.d.ts +++ b/api/@ohos.curves.d.ts @@ -1,5 +1,5 @@ /* -* Copyright (c) 2021 Huawei Device Co., Ltd. +* Copyright (c) 2021-2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -17,12 +17,12 @@ * Contains interpolator functions such as initialization, third-order Bezier curves, and spring curves. * @import import Curves from '@ohos.curves' * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 7 + * @since 9 */ declare namespace curves { /** * enum Curve. - * @since 7 + * @since 9 */ enum Curve { Linear, @@ -40,29 +40,41 @@ declare namespace curves { Friction, } + /** + * Interface for curve object. + * @since 9 + */ + interface ICurve { + /** + * Get curve value by fraction. + * @since 9 + */ + interpolate(fraction : number) : number; + } /** * Initializes the interpolator curve when called. - * @since 7 + * @since 9 */ - function init(curve?: Curve): string; + function init(curve?: Curve): ICurve; /** * Constructs a step curve when called. - * @since 7 + * @since 9 */ - function steps(count: number, end: boolean): string; + function steps(count: number, end: boolean): ICurve; /** * Constructs a third-order Bezier curve when called. * @since 7 + * @deprecated since 9 */ - function cubicBezier(x1: number, y1: number, x2: number, y2: number): string; + function cubicBezier(x1: number, y1: number, x2: number, y2: number): ICurve; /** * Constructs a spring curve when called. - * @since 7 + * @since 9 */ - function spring(velocity: number, mass: number, stiffness: number, damping: number): string; + function spring(velocity: number, mass: number, stiffness: number, damping: number): ICurve; } export default curves; -- Gitee From 75d5c7d4af87714bc167756e2dded6fc09697b6d Mon Sep 17 00:00:00 2001 From: lanyill Date: Wed, 1 Jun 2022 17:45:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E3=80=90ArkUI=E3=80=91=E3=80=90API9?= =?UTF-8?q?=E3=80=91Interpolate=E6=8E=A5=E5=8F=A3=E4=B8=8D=20=E5=8F=AF?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: lanyill Change-Id: I3b560c398353b3ceb8101d06967ac0875a780649 --- api/@internal/component/ets/common.d.ts | 14 +++++++++- api/@ohos.curves.d.ts | 37 ++++++++++++++++++++++--- 2 files changed, 46 insertions(+), 5 deletions(-) diff --git a/api/@internal/component/ets/common.d.ts b/api/@internal/component/ets/common.d.ts index d410c9d35a..5c1fc59a44 100644 --- a/api/@internal/component/ets/common.d.ts +++ b/api/@internal/component/ets/common.d.ts @@ -227,7 +227,7 @@ declare interface AnimateParam { * Animation curve. * @since 7 */ - curve?: Curve | string; + curve?: Curve | string | ICurve; /** * Animation playback mode. By default, the animation is played from the beginning after the playback is complete. * @since 7 @@ -250,6 +250,18 @@ declare interface AnimateParam { onFinish?: () => void; } +/** + * Interface for curve object. + * @since 9 + */ +interface ICurve { + /** + * Get curve value by fraction. + * @since 9 + */ + interpolate(fraction : number) : number; +} + /** * Defines the motion path options. * @since 7 diff --git a/api/@ohos.curves.d.ts b/api/@ohos.curves.d.ts index 57d03e20a4..68cd78e3be 100644 --- a/api/@ohos.curves.d.ts +++ b/api/@ohos.curves.d.ts @@ -17,12 +17,12 @@ * Contains interpolator functions such as initialization, third-order Bezier curves, and spring curves. * @import import Curves from '@ohos.curves' * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 9 + * @since 7 */ declare namespace curves { /** * enum Curve. - * @since 9 + * @since 7 */ enum Curve { Linear, @@ -45,18 +45,26 @@ declare namespace curves { * @since 9 */ interface ICurve { - /** + /** * Get curve value by fraction. * @since 9 */ interpolate(fraction : number) : number; } + /** * Initializes the interpolator curve when called. * @since 9 */ function init(curve?: Curve): ICurve; + /** + * Initializes the interpolator curve when called. + * @since 7 + * @deprecated since 9 + */ + function init(curve?: Curve): string; + /** * Constructs a step curve when called. * @since 9 @@ -64,17 +72,38 @@ declare namespace curves { function steps(count: number, end: boolean): ICurve; /** - * Constructs a third-order Bezier curve when called. + * Constructs a step curve when called. * @since 7 * @deprecated since 9 */ + function steps(count: number, end: boolean): string; + + /** + * Constructs a third-order Bezier curve when called. + * @since 9 + */ function cubicBezier(x1: number, y1: number, x2: number, y2: number): ICurve; + /** + * Constructs a third-order Bezier curve when called. + * @since 7 + * @deprecated since 9 + */ + function cubicBezier(x1: number, y1: number, x2: number, y2: number): string; + /** * Constructs a spring curve when called. * @since 9 */ function spring(velocity: number, mass: number, stiffness: number, damping: number): ICurve; + + /** + * Constructs a spring curve when called. + * @since 7 + * @deprecated since 9 + */ + function spring(velocity: number, mass: number, stiffness: number, damping: number): string; + } export default curves; -- Gitee