1/* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * Customize spring properties. 18 * @since 7 19 * @systemapi 20 */ 21declare class SpringProp { 22 /** 23 * Constructor parameters 24 * @since 7 25 * @systemapi 26 */ 27 constructor(mass: number, stiffness: number, damping: number); 28} 29 30/** 31 * Spring animation model. You can build a spring animation based on the start point, end point, initial speed, and spring attributes. 32 * @since 7 33 * @systemapi 34 */ 35declare class SpringMotion { 36 /** 37 * Constructor parameters 38 * @since 7 39 * @systemapi 40 */ 41 constructor(start: number, end: number, velocity: number, prop: SpringProp); 42} 43 44/** 45 * Friction animation model. You can build friction animation by friction force, initial position, and initial velocity. 46 * @since 7 47 * @systemapi 48 */ 49declare class FrictionMotion { 50 /** 51 * Constructor parameters 52 * @since 7 53 * @systemapi 54 */ 55 constructor(friction: number, position: number, velocity: number); 56} 57 58/** 59 * Rolling animation model: You can build rolling animation based on the initial position, initial speed, boundary position, and spring attributes. 60 * @since 7 61 * @systemapi 62 */ 63declare class ScrollMotion { 64 /** 65 * Constructor parameters 66 * @since 7 67 * @systemapi 68 */ 69 constructor(position: number, velocity: number, min: number, max: number, prop: SpringProp); 70} 71 72/** 73 * Defines Animator. 74 * @since 7 75 * @systemapi 76 */ 77interface AnimatorInterface { 78 /** 79 * Constructor parameters 80 * @since 7 81 * @systemapi 82 */ 83 (value: string): AnimatorAttribute; 84} 85 86/** 87 * Defines AnimatorAttribute. 88 * @since 7 89 * @systemapi 90 */ 91declare class AnimatorAttribute extends CommonMethod<AnimatorAttribute> { 92 /** 93 * Controls the playback status. The default value is the initial state. 94 * @since 7 95 * @systemapi 96 */ 97 state(value: AnimationStatus): AnimatorAttribute; 98 99 /** 100 * Animation duration, in milliseconds. 101 * @since 7 102 * @systemapi 103 */ 104 duration(value: number): AnimatorAttribute; 105 106 /** 107 * Animation curve, default to linear curve 108 * @since 7 109 * @systemapi 110 */ 111 curve(value: Curve): AnimatorAttribute; 112 113 /** 114 * Delayed animation playback duration, in milliseconds. By default, the animation is not delayed. 115 * @since 7 116 * @systemapi 117 */ 118 delay(value: number): AnimatorAttribute; 119 120 /** 121 * Sets the state before and after the animation starts. 122 * @since 7 123 * @systemapi 124 */ 125 fillMode(value: FillMode): AnimatorAttribute; 126 127 /** 128 * The default playback is once. If the value is -1, the playback is unlimited. 129 * @since 7 130 * @systemapi 131 */ 132 iterations(value: number): AnimatorAttribute; 133 134 /** 135 * Sets the animation playback mode. By default, the animation starts to play again after the playback is complete. 136 * @since 7 137 * @systemapi 138 */ 139 playMode(value: PlayMode): AnimatorAttribute; 140 141 /** 142 * Configure the physical animation algorithm. 143 * @since 7 144 * @systemapi 145 */ 146 motion(value: SpringMotion | FrictionMotion | ScrollMotion): AnimatorAttribute; 147 148 /** 149 * Status callback, which is triggered when the animation starts to play. 150 * @since 7 151 * @systemapi 152 */ 153 onStart(event: () => void): AnimatorAttribute; 154 155 /** 156 * Status callback, triggered when the animation pauses. 157 * @since 7 158 * @systemapi 159 */ 160 onPause(event: () => void): AnimatorAttribute; 161 162 /** 163 * Status callback, triggered when the animation is replayed. 164 * @since 7 165 * @systemapi 166 */ 167 onRepeat(event: () => void): AnimatorAttribute; 168 169 /** 170 * Status callback, which is triggered when the animation is canceled. 171 * @since 7 172 * @systemapi 173 */ 174 onCancel(event: () => void): AnimatorAttribute; 175 176 /** 177 * Status callback, which is triggered when the animation playback is complete. 178 * @since 7 179 * @systemapi 180 */ 181 onFinish(event: () => void): AnimatorAttribute; 182 183 /** 184 * The callback input parameter is the interpolation during animation playback. 185 * @since 7 186 * @systemapi 187 */ 188 onFrame(event: (value: number) => void): AnimatorAttribute; 189} 190 191/** 192 * Defines Animator Component. 193 * @since 7 194 * @systemapi 195 */ 196declare const Animator: AnimatorInterface; 197 198/** 199 * Defines Animator Component instance. 200 * @since 7 201 * @systemapi 202 */ 203declare const AnimatorInstance: AnimatorAttribute; 204