'use static'
/*
 * Copyright (c) 2025 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
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file
 * @kit ArkUI
 */

import { FillMode, PlayMode } from '@ohos.arkui.component';
import { ExpectedFrameRateRange } from '@ohos.arkui.component';
export { FillMode, PlayMode } from '@ohos.arkui.component';


/**
 * Defines the animator options.
 * @interface AnimatorOptions
 * @syscap SystemCapability.ArkUI.ArkUI.Full
 * @stagemodelonly
 * @since 23 static
 */
export interface AnimatorOptions {
    
    
    /**
     * Duration of the animation, in milliseconds.
     * The default value is 0.
     * @type {int}
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    duration: int;
    
    
    /**
     * Time curve of the animation. For details about the supported types.
     * linear The animation speed keeps unchanged.
     * ease The animation starts and ends at a low speed, cubic-bezier(0.25, 0.1, 0.25, 1.0).
     * ease-in The animation starts at a low speed, cubic-bezier(0.42, 0.0, 1.0, 1.0).
     * ease-out The animation ends at a low speed, cubic-bezier(0.0, 0.0, 0.58, 1.0).
     * ease-in-out The animation starts and ends at a low speed, cubic-bezier(0.42, 0.0, 0.58, 1.0).
     * fast-out-slow-in Standard curve, cubic-bezier(0.4, 0.0, 0.2, 1.0).
     * linear-out-slow-in Deceleration curve, cubic-bezier(0.0, 0.0, 0.2, 1.0).
     * fast-out-linear-in Acceleration curve, cubic-bezier(0.4, 0.0, 1.0, 1.0).
     * friction Damping curve, cubic-bezier(0.2, 0.0, 0.2, 1.0).
     * extreme-deceleration Extreme deceleration curve, cubic-bezier(0.0, 0.0, 0.0, 1.0).
     * sharp Sharp curve, cubic-bezier(0.33, 0.0, 0.67, 1.0).
     * rhythm Rhythm curve, cubic-bezier(0.7, 0.0, 0.2, 1.0).
     * smooth Smooth curve, cubic-bezier(0.4, 0.0, 0.4, 1.0).
     * cubic-bezier(x1, y1, x2, y2) You can customize an animation speed curve in the cubic-bezier() function.
     * The x and y values of each input parameter must be between 0 and 1.
     * Step curve. The number must be set and only an integer is supported, step-position is optional.
     * It can be set to start or end. The default value is end.
     * interpolating-spring(velocity, mass, stiffness, damping), interpolating spring curve.
     * The default value is ease.
     * @type {string}
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    easing: string;
    
    
    /**
     * Delay for the animation start. The default value indicates no delay.
     * The default value is 0.
     * @type {int}
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    delay: int;
    
    
    /**
     * Whether to resume to the initial state after the animation is executed.
     * none: The initial state is restored after the animation is executed.
     * forwards: The state at the end of the animation (defined in the last key frame)
     * is retained after the animation is executed.
     * @type {"none" | "forwards" | "backwards" | "both"}
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    fill: "none" | "forwards" | "backwards" | "both";
    
    
    /**
     * The animation playback mode.
     * The default value is "normal".
     * @type {"normal" | "reverse" | "alternate" | "alternate-reverse"}
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    direction: "normal" | "reverse" | "alternate" | "alternate-reverse";
    
    
    /**
     * Number of times the animation will be played.
     * Number indicates a fixed number of playback operations, and -1 an unlimited number of playback operations.
     * The default value is 1.
     * @type {int}
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    iterations: int;
    
    
    /**
     * Starting point of animator interpolation.
     * The default value is 0.
     * @type {double}
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    begin: double;
    
    
    /**
     * Ending point of Dynamic Interpolation
     * The default value is 1.
     * @type {double}
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    end: double;
}
/**
 * Defines the SimpleAnimatorOptions class.
 *
 * @syscap SystemCapability.ArkUI.ArkUI.Full
 * @stagemodelonly
 * @since 23 static
 */
export declare class SimpleAnimatorOptions {
    /**
     * constructor.
     *
     * @param { double } begin - Starting point of animator interpolation.
     * @param { double } end - Ending point of animator interpolation.
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    constructor(begin: double, end: double);
    /**
     * Set duration of the animation, in milliseconds.
     *
     * @param { int } duration - if not set, default is 1000.
     * @returns { SimpleAnimatorOptions }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    duration(duration: int): SimpleAnimatorOptions;
    /**
     * Set time curve of the animation. For details about the supported types.
     * linear The animation speed keeps unchanged.
     * ease The animation starts and ends at a low speed, cubic-bezier(0.25, 0.1, 0.25, 1.0).
     * ease-in The animation starts at a low speed, cubic-bezier(0.42, 0.0, 1.0, 1.0).
     * ease-out The animation ends at a low speed, cubic-bezier(0.0, 0.0, 0.58, 1.0).
     * ease-in-out The animation starts and ends at a low speed, cubic-bezier(0.42, 0.0, 0.58, 1.0).
     * fast-out-slow-in Standard curve, cubic-bezier(0.4, 0.0, 0.2, 1.0).
     * linear-out-slow-in Deceleration curve, cubic-bezier(0.0, 0.0, 0.2, 1.0).
     * fast-out-linear-in Acceleration curve, cubic-bezier(0.4, 0.0, 1.0, 1.0).
     * friction Damping curve, cubic-bezier(0.2, 0.0, 0.2, 1.0).
     * extreme-deceleration Extreme deceleration curve, cubic-bezier(0.0, 0.0, 0.0, 1.0).
     * sharp Sharp curve, cubic-bezier(0.33, 0.0, 0.67, 1.0).
     * rhythm Rhythm curve, cubic-bezier(0.7, 0.0, 0.2, 1.0).
     * smooth Smooth curve, cubic-bezier(0.4, 0.0, 0.4, 1.0).
     * cubic-bezier(x1, y1, x2, y2) You can customize an animation speed curve in the cubic-bezier() function.
     * The x and y values of each input parameter must be between 0 and 1.
     * Step curve. The number must be set and only an integer is supported, step-position is optional.
     * It can be set to start or end. The default value is end.
     * @param { string } curve - if not set, default is ease.
     * @returns { SimpleAnimatorOptions }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    easing(curve: string): SimpleAnimatorOptions;
    /**
     * Set delay for the animation start. The default value indicates no delay.
     *
     * @param { int } delay - if not set, default is 0.
     * @returns { SimpleAnimatorOptions }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    delay(delay: int): SimpleAnimatorOptions;
    /**
     * Set FillMode of animation.
     * FillMode indicates whether to resume to the initial state after the animation is executed.
     *
     * @param { FillMode } fillMode - if not set, default is FillMode.Forwards.
     * @returns { SimpleAnimatorOptions }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    fill(fillMode: FillMode): SimpleAnimatorOptions;
    /**
     * Set the animation playback mode.
     *
     * @param { PlayMode } direction - if not set, default is PlayMode.Normal.
     * @returns { SimpleAnimatorOptions }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    direction(direction: PlayMode): SimpleAnimatorOptions;
    /**
     * Set number of times the animation will be played.
     * Number indicates a fixed number of playback operations, and -1 an unlimited number of playback operations.
     *
     * @param { int } iterations - if not set, default is 1.
     * @returns { SimpleAnimatorOptions }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    iterations(iterations: int): SimpleAnimatorOptions;
}


/**
 * Defines the Animator result interface.
 * @interface AnimatorResult
 * @syscap SystemCapability.ArkUI.ArkUI.Full
 * @stagemodelonly
 * @since 23 static
 */
export interface AnimatorResult {
    
    /**
     * Reset the options for current animator.
     * @param { AnimatorOptions | SimpleAnimatorOptions } options - Options.
     * @throws { BusinessError } 401 - Parameter error. Possible causes:
     * <br> 1. Mandatory parameters are left unspecified.
     * <br> 2. Incorrect parameters types.
     * <br> 3. Parameter verification failed.
     * @throws { BusinessError } 100001 - The specified page is not found or the object property list is not obtained.
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    reset(options: AnimatorOptions | SimpleAnimatorOptions): void;
    
    
    /**
     * Starts the animation.
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    play(): void;
    
    
    /**
     * Ends the animation.
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    finish(): void;
    
    
    /**
     * Pauses the animation.
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    pause(): void;
    
    
    /**
     * Cancels the animation.
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    cancel(): void;
    
    
    /**
     * Plays the animation in reverse direction.
     * Invalid when using interpolating-spring curve.
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    reverse(): void;
    /**
     * Trigger when vSync callback.
     *
     * @type { function }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    onFrame: (progress: double) => void;
    /**
     * The animation is finished.
     *
     * @type { function }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    onFinish: () => void;
    /**
     * The animation is canceled.
     *
     * @type { function }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    onCancel: () => void;
    /**
     * The animation is repeated.
     *
     * @type { function }
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    onRepeat: () => void;
    /**
     * The expected frame rate of dynamical of rate range.
     * @param { ExpectedFrameRateRange } rateRange - Indicates ExpectedFrameRateRange.
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    setExpectedFrameRateRange(rateRange: ExpectedFrameRateRange): void;
}

/**
 * Defines the Animator class.
 *
 * @syscap SystemCapability.ArkUI.ArkUI.Full
 * @stagemodelonly
 * @since 23 static
 */
export default declare class Animator {
    /**
     * Create an animator object for custom animation.
     * This interface depends on the UI context and cannot be used when the UI context is unclear. It is recommended to
     * use {@link ohos.arkui.UIContext.UIContext#createAnimator}.
     *
     * @param { AnimatorOptions | SimpleAnimatorOptions } options - Options.
     * @returns { AnimatorResult } - animator result
     * @throws { BusinessError } 401 - Parameter error. Possible causes:
     *     <br> 1. Mandatory parameters are left unspecified.
     *     <br> 2. Incorrect parameters types.
     *     <br> 3. Parameter verification failed.
     * @static
     * @syscap SystemCapability.ArkUI.ArkUI.Full
     * @stagemodelonly
     * @since 23 static
     */
    static create(options: AnimatorOptions | SimpleAnimatorOptions): AnimatorResult;
}