161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2021 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit ArkUI 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ci/** 2261847f8eSopenharmony_ci * Customize spring properties. 2361847f8eSopenharmony_ci * 2461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 2561847f8eSopenharmony_ci * @systemapi 2661847f8eSopenharmony_ci * @since 7 2761847f8eSopenharmony_ci */ 2861847f8eSopenharmony_cideclare class SpringProp { 2961847f8eSopenharmony_ci /** 3061847f8eSopenharmony_ci * Constructor parameters 3161847f8eSopenharmony_ci * 3261847f8eSopenharmony_ci * @param { number } mass 3361847f8eSopenharmony_ci * @param { number } stiffness 3461847f8eSopenharmony_ci * @param { number } damping 3561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 3661847f8eSopenharmony_ci * @systemapi 3761847f8eSopenharmony_ci * @since 7 3861847f8eSopenharmony_ci */ 3961847f8eSopenharmony_ci constructor(mass: number, stiffness: number, damping: number); 4061847f8eSopenharmony_ci} 4161847f8eSopenharmony_ci 4261847f8eSopenharmony_ci/** 4361847f8eSopenharmony_ci * Spring animation model. You can build a spring animation based on the start point, end point, initial speed, and spring attributes. 4461847f8eSopenharmony_ci * 4561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 4661847f8eSopenharmony_ci * @systemapi 4761847f8eSopenharmony_ci * @since 7 4861847f8eSopenharmony_ci */ 4961847f8eSopenharmony_cideclare class SpringMotion { 5061847f8eSopenharmony_ci /** 5161847f8eSopenharmony_ci * Constructor parameters 5261847f8eSopenharmony_ci * 5361847f8eSopenharmony_ci * @param { number } start 5461847f8eSopenharmony_ci * @param { number } end 5561847f8eSopenharmony_ci * @param { number } velocity 5661847f8eSopenharmony_ci * @param { SpringProp } prop 5761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 5861847f8eSopenharmony_ci * @systemapi 5961847f8eSopenharmony_ci * @since 7 6061847f8eSopenharmony_ci */ 6161847f8eSopenharmony_ci constructor(start: number, end: number, velocity: number, prop: SpringProp); 6261847f8eSopenharmony_ci} 6361847f8eSopenharmony_ci 6461847f8eSopenharmony_ci/** 6561847f8eSopenharmony_ci * Friction animation model. You can build friction animation by friction force, initial position, and initial velocity. 6661847f8eSopenharmony_ci * 6761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 6861847f8eSopenharmony_ci * @systemapi 6961847f8eSopenharmony_ci * @since 7 7061847f8eSopenharmony_ci */ 7161847f8eSopenharmony_cideclare class FrictionMotion { 7261847f8eSopenharmony_ci /** 7361847f8eSopenharmony_ci * Constructor parameters 7461847f8eSopenharmony_ci * 7561847f8eSopenharmony_ci * @param { number } friction 7661847f8eSopenharmony_ci * @param { number } position 7761847f8eSopenharmony_ci * @param { number } velocity 7861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 7961847f8eSopenharmony_ci * @systemapi 8061847f8eSopenharmony_ci * @since 7 8161847f8eSopenharmony_ci */ 8261847f8eSopenharmony_ci constructor(friction: number, position: number, velocity: number); 8361847f8eSopenharmony_ci} 8461847f8eSopenharmony_ci 8561847f8eSopenharmony_ci/** 8661847f8eSopenharmony_ci * Rolling animation model: You can build rolling animation based on the initial position, initial speed, boundary position, and spring attributes. 8761847f8eSopenharmony_ci * 8861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 8961847f8eSopenharmony_ci * @systemapi 9061847f8eSopenharmony_ci * @since 7 9161847f8eSopenharmony_ci */ 9261847f8eSopenharmony_cideclare class ScrollMotion { 9361847f8eSopenharmony_ci /** 9461847f8eSopenharmony_ci * Constructor parameters 9561847f8eSopenharmony_ci * 9661847f8eSopenharmony_ci * @param { number } position 9761847f8eSopenharmony_ci * @param { number } velocity 9861847f8eSopenharmony_ci * @param { number } min 9961847f8eSopenharmony_ci * @param { number } max 10061847f8eSopenharmony_ci * @param { SpringProp } prop 10161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 10261847f8eSopenharmony_ci * @systemapi 10361847f8eSopenharmony_ci * @since 7 10461847f8eSopenharmony_ci */ 10561847f8eSopenharmony_ci constructor(position: number, velocity: number, min: number, max: number, prop: SpringProp); 10661847f8eSopenharmony_ci} 10761847f8eSopenharmony_ci 10861847f8eSopenharmony_ci/** 10961847f8eSopenharmony_ci * Defines Animator. 11061847f8eSopenharmony_ci * 11161847f8eSopenharmony_ci * @interface AnimatorInterface 11261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 11361847f8eSopenharmony_ci * @systemapi 11461847f8eSopenharmony_ci * @since 7 11561847f8eSopenharmony_ci */ 11661847f8eSopenharmony_ciinterface AnimatorInterface { 11761847f8eSopenharmony_ci /** 11861847f8eSopenharmony_ci * Constructor parameters 11961847f8eSopenharmony_ci * 12061847f8eSopenharmony_ci * @param { string } value 12161847f8eSopenharmony_ci * @returns { AnimatorAttribute } 12261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 12361847f8eSopenharmony_ci * @systemapi 12461847f8eSopenharmony_ci * @since 7 12561847f8eSopenharmony_ci */ 12661847f8eSopenharmony_ci (value: string): AnimatorAttribute; 12761847f8eSopenharmony_ci} 12861847f8eSopenharmony_ci 12961847f8eSopenharmony_ci/** 13061847f8eSopenharmony_ci * Defines AnimatorAttribute. 13161847f8eSopenharmony_ci * 13261847f8eSopenharmony_ci * @extends CommonMethod<AnimatorAttribute> 13361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 13461847f8eSopenharmony_ci * @systemapi 13561847f8eSopenharmony_ci * @since 7 13661847f8eSopenharmony_ci */ 13761847f8eSopenharmony_cideclare class AnimatorAttribute extends CommonMethod<AnimatorAttribute> { 13861847f8eSopenharmony_ci /** 13961847f8eSopenharmony_ci * Controls the playback status. The default value is the initial state. 14061847f8eSopenharmony_ci * 14161847f8eSopenharmony_ci * @param { AnimationStatus } value 14261847f8eSopenharmony_ci * @returns { AnimatorAttribute } 14361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 14461847f8eSopenharmony_ci * @systemapi 14561847f8eSopenharmony_ci * @since 7 14661847f8eSopenharmony_ci */ 14761847f8eSopenharmony_ci state(value: AnimationStatus): AnimatorAttribute; 14861847f8eSopenharmony_ci 14961847f8eSopenharmony_ci /** 15061847f8eSopenharmony_ci * Animation duration, in milliseconds. 15161847f8eSopenharmony_ci * 15261847f8eSopenharmony_ci * @param { number } value 15361847f8eSopenharmony_ci * @returns { AnimatorAttribute } 15461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 15561847f8eSopenharmony_ci * @systemapi 15661847f8eSopenharmony_ci * @since 7 15761847f8eSopenharmony_ci */ 15861847f8eSopenharmony_ci duration(value: number): AnimatorAttribute; 15961847f8eSopenharmony_ci 16061847f8eSopenharmony_ci /** 16161847f8eSopenharmony_ci * Animation curve, default to linear curve 16261847f8eSopenharmony_ci * 16361847f8eSopenharmony_ci * @param { Curve } value 16461847f8eSopenharmony_ci * @returns { AnimatorAttribute } 16561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 16661847f8eSopenharmony_ci * @systemapi 16761847f8eSopenharmony_ci * @since 7 16861847f8eSopenharmony_ci */ 16961847f8eSopenharmony_ci curve(value: Curve): AnimatorAttribute; 17061847f8eSopenharmony_ci 17161847f8eSopenharmony_ci /** 17261847f8eSopenharmony_ci * Delayed animation playback duration, in milliseconds. By default, the animation is not delayed. 17361847f8eSopenharmony_ci * 17461847f8eSopenharmony_ci * @param { number } value 17561847f8eSopenharmony_ci * @returns { AnimatorAttribute } 17661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 17761847f8eSopenharmony_ci * @systemapi 17861847f8eSopenharmony_ci * @since 7 17961847f8eSopenharmony_ci */ 18061847f8eSopenharmony_ci delay(value: number): AnimatorAttribute; 18161847f8eSopenharmony_ci 18261847f8eSopenharmony_ci /** 18361847f8eSopenharmony_ci * Sets the state before and after the animation starts. 18461847f8eSopenharmony_ci * 18561847f8eSopenharmony_ci * @param { FillMode } value 18661847f8eSopenharmony_ci * @returns { AnimatorAttribute } 18761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 18861847f8eSopenharmony_ci * @systemapi 18961847f8eSopenharmony_ci * @since 7 19061847f8eSopenharmony_ci */ 19161847f8eSopenharmony_ci fillMode(value: FillMode): AnimatorAttribute; 19261847f8eSopenharmony_ci 19361847f8eSopenharmony_ci /** 19461847f8eSopenharmony_ci * The default playback is once. If the value is -1, the playback is unlimited. 19561847f8eSopenharmony_ci * 19661847f8eSopenharmony_ci * @param { number } value 19761847f8eSopenharmony_ci * @returns { AnimatorAttribute } 19861847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 19961847f8eSopenharmony_ci * @systemapi 20061847f8eSopenharmony_ci * @since 7 20161847f8eSopenharmony_ci */ 20261847f8eSopenharmony_ci iterations(value: number): AnimatorAttribute; 20361847f8eSopenharmony_ci 20461847f8eSopenharmony_ci /** 20561847f8eSopenharmony_ci * Sets the animation playback mode. By default, the animation starts to play again after the playback is complete. 20661847f8eSopenharmony_ci * 20761847f8eSopenharmony_ci * @param { PlayMode } value 20861847f8eSopenharmony_ci * @returns { AnimatorAttribute } 20961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 21061847f8eSopenharmony_ci * @systemapi 21161847f8eSopenharmony_ci * @since 7 21261847f8eSopenharmony_ci */ 21361847f8eSopenharmony_ci playMode(value: PlayMode): AnimatorAttribute; 21461847f8eSopenharmony_ci 21561847f8eSopenharmony_ci /** 21661847f8eSopenharmony_ci * Configure the physical animation algorithm. 21761847f8eSopenharmony_ci * 21861847f8eSopenharmony_ci * @param { SpringMotion | FrictionMotion | ScrollMotion } value 21961847f8eSopenharmony_ci * @returns { AnimatorAttribute } 22061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 22161847f8eSopenharmony_ci * @systemapi 22261847f8eSopenharmony_ci * @since 7 22361847f8eSopenharmony_ci */ 22461847f8eSopenharmony_ci motion(value: SpringMotion | FrictionMotion | ScrollMotion): AnimatorAttribute; 22561847f8eSopenharmony_ci 22661847f8eSopenharmony_ci /** 22761847f8eSopenharmony_ci * Status callback, which is triggered when the animation starts to play. 22861847f8eSopenharmony_ci * 22961847f8eSopenharmony_ci * @param { function } event 23061847f8eSopenharmony_ci * @returns { AnimatorAttribute } 23161847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 23261847f8eSopenharmony_ci * @systemapi 23361847f8eSopenharmony_ci * @since 7 23461847f8eSopenharmony_ci */ 23561847f8eSopenharmony_ci onStart(event: () => void): AnimatorAttribute; 23661847f8eSopenharmony_ci 23761847f8eSopenharmony_ci /** 23861847f8eSopenharmony_ci * Status callback, triggered when the animation pauses. 23961847f8eSopenharmony_ci * 24061847f8eSopenharmony_ci * @param { function } event 24161847f8eSopenharmony_ci * @returns { AnimatorAttribute } 24261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 24361847f8eSopenharmony_ci * @systemapi 24461847f8eSopenharmony_ci * @since 7 24561847f8eSopenharmony_ci */ 24661847f8eSopenharmony_ci onPause(event: () => void): AnimatorAttribute; 24761847f8eSopenharmony_ci 24861847f8eSopenharmony_ci /** 24961847f8eSopenharmony_ci * Status callback, triggered when the animation is replayed. 25061847f8eSopenharmony_ci * 25161847f8eSopenharmony_ci * @param { function } event 25261847f8eSopenharmony_ci * @returns { AnimatorAttribute } 25361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 25461847f8eSopenharmony_ci * @systemapi 25561847f8eSopenharmony_ci * @since 7 25661847f8eSopenharmony_ci */ 25761847f8eSopenharmony_ci onRepeat(event: () => void): AnimatorAttribute; 25861847f8eSopenharmony_ci 25961847f8eSopenharmony_ci /** 26061847f8eSopenharmony_ci * Status callback, which is triggered when the animation is canceled. 26161847f8eSopenharmony_ci * 26261847f8eSopenharmony_ci * @param { function } event 26361847f8eSopenharmony_ci * @returns { AnimatorAttribute } 26461847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 26561847f8eSopenharmony_ci * @systemapi 26661847f8eSopenharmony_ci * @since 7 26761847f8eSopenharmony_ci */ 26861847f8eSopenharmony_ci onCancel(event: () => void): AnimatorAttribute; 26961847f8eSopenharmony_ci 27061847f8eSopenharmony_ci /** 27161847f8eSopenharmony_ci * Status callback, which is triggered when the animation playback is complete. 27261847f8eSopenharmony_ci * 27361847f8eSopenharmony_ci * @param { function } event 27461847f8eSopenharmony_ci * @returns { AnimatorAttribute } 27561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 27661847f8eSopenharmony_ci * @systemapi 27761847f8eSopenharmony_ci * @since 7 27861847f8eSopenharmony_ci */ 27961847f8eSopenharmony_ci onFinish(event: () => void): AnimatorAttribute; 28061847f8eSopenharmony_ci 28161847f8eSopenharmony_ci /** 28261847f8eSopenharmony_ci * The callback input parameter is the interpolation during animation playback. 28361847f8eSopenharmony_ci * 28461847f8eSopenharmony_ci * @param { function } event 28561847f8eSopenharmony_ci * @returns { AnimatorAttribute } 28661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 28761847f8eSopenharmony_ci * @systemapi 28861847f8eSopenharmony_ci * @since 7 28961847f8eSopenharmony_ci */ 29061847f8eSopenharmony_ci onFrame(event: (value: number) => void): AnimatorAttribute; 29161847f8eSopenharmony_ci} 29261847f8eSopenharmony_ci 29361847f8eSopenharmony_ci/** 29461847f8eSopenharmony_ci * Defines Animator Component. 29561847f8eSopenharmony_ci * 29661847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 29761847f8eSopenharmony_ci * @systemapi 29861847f8eSopenharmony_ci * @since 7 29961847f8eSopenharmony_ci */ 30061847f8eSopenharmony_cideclare const Animator: AnimatorInterface; 30161847f8eSopenharmony_ci 30261847f8eSopenharmony_ci/** 30361847f8eSopenharmony_ci * Defines Animator Component instance. 30461847f8eSopenharmony_ci * 30561847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full 30661847f8eSopenharmony_ci * @systemapi 30761847f8eSopenharmony_ci * @since 9 30861847f8eSopenharmony_ci */ 30961847f8eSopenharmony_cideclare const AnimatorInstance: AnimatorAttribute; 310