diff --git a/api/@internal/component/ets/common.d.ts b/api/@internal/component/ets/common.d.ts index d410c9d35a5e2e7a03c9743edc7914167f3059b2..5c1fc59a44facda33366523a0e27e5db3e98d658 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 e3a377d6cea5acb289960fa17e9223cf55a1d2f8..68cd78e3beba6d6494148c74bf1cefcaafe0db08 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,29 +40,70 @@ 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 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 + */ + function steps(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 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;