From c509e6815be8c283c14d0458ab9c5d231ff61e05 Mon Sep 17 00:00:00 2001 From: lanyill Date: Mon, 6 Jun 2022 16:42:33 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90ArkUI=E3=80=91=E3=80=90API9=E3=80=91In?= =?UTF-8?q?terpolate=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: I833ef0cc31094f2ccc1659ff4324e78cf958509f --- api/@internal/component/ets/common.d.ts | 14 ++++++++- api/@ohos.curves.d.ts | 42 ++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 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 e3a377d6ce..943381f939 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 @@ -40,27 +40,67 @@ 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 9 + */ + function initCurve(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 + */ + function stepsCurve(count: number, end: boolean): ICurve; + /** * 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 cubicBezierCurve(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 springCurve(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; } -- Gitee