diff --git a/api/@internal/component/ets/common.d.ts b/api/@internal/component/ets/common.d.ts index d410c9d35a5e2e7a03c9743edc7914167f3059b2..f58a1ad921f8a973eacf105fe98eaddf26860162 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 @@ -291,7 +303,7 @@ declare interface sharedTransitionOptions { * Animation duration, in ms. * @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 diff --git a/api/@internal/component/ets/middle_class.d.ts b/api/@internal/component/ets/middle_class.d.ts index 0b11a3d26c5444c2c66e1e329e113d7a13020bd9..fe1eb5ad7812c4ef786527dd45fc456f79a9a6db 100644 --- a/api/@internal/component/ets/middle_class.d.ts +++ b/api/@internal/component/ets/middle_class.d.ts @@ -1012,7 +1012,7 @@ declare class TSPageTransitionEnterInterface extends CommonTransition { * Called when sliding is curve * @since 8 */ - curve(value: Curve | string): SwiperAttribute; + curve(value: Curve | string | ICurve): SwiperAttribute; /** * Called when the index value changes. * @since 7 diff --git a/api/@ohos.curves.d.ts b/api/@ohos.curves.d.ts index e3a377d6cea5acb289960fa17e9223cf55a1d2f8..359c181be7b7e50b7bb3ac2ce7f01ad5b207f261 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 initCure(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; }