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 * Defines the ImageAnimator Interface. 18 * @since 7 19 */ 20interface ImageAnimatorInterface { 21 /** 22 * ImageAimator is returned. 23 * @since 7 24 */ 25 (): ImageAnimatorAttribute; 26} 27 28/** 29 * inheritance CommonMethod 30 * @since 7 31 */ 32declare class ImageAnimatorAttribute extends CommonMethod<ImageAnimatorAttribute> { 33 /** 34 * list images 35 * @since 7 36 */ 37 images( 38 value: Array<{ 39 src: string; 40 width?: number | string; 41 height?: number | string; 42 top?: number | string; 43 left?: number | string; 44 duration?: number; 45 }>, 46 ): ImageAnimatorAttribute; 47 48 /** 49 * The default value is the initial state, which is used to control the playback status. 50 * @since 7 51 */ 52 state(value: AnimationStatus): ImageAnimatorAttribute; 53 54 /** 55 * The unit is millisecond. 56 * @since 7 57 */ 58 duration(value: number): ImageAnimatorAttribute; 59 60 /** 61 * Set the playback sequence. 62 * @since 7 63 */ 64 reverse(value: boolean): ImageAnimatorAttribute; 65 66 /** 67 * Sets whether the image size is fixed to the component size. 68 * @since 7 69 */ 70 fixedSize(value: boolean): ImageAnimatorAttribute; 71 72 /** 73 * Indicates whether to enable pre-decoding. 74 * @since 7 75 */ 76 preDecode(value: number): ImageAnimatorAttribute; 77 78 /** 79 * Sets the state before and after the animation starts 80 * @since 7 81 */ 82 fillMode(value: FillMode): ImageAnimatorAttribute; 83 84 /** 85 * Played once by default 86 * @since 7 87 */ 88 iterations(value: number): ImageAnimatorAttribute; 89 90 /** 91 * Status callback, which is triggered when the animation starts to play. 92 * @since 7 93 */ 94 onStart(event: () => void): ImageAnimatorAttribute; 95 96 /** 97 * Status callback, which is triggered when the animation pauses. 98 * @since 7 99 */ 100 onPause(event: () => void): ImageAnimatorAttribute; 101 102 /** 103 * Status callback, triggered when the animation is replayed 104 * @since 7 105 */ 106 onRepeat(event: () => void): ImageAnimatorAttribute; 107 108 /** 109 * Status callback, which is triggered when the animation is canceled. 110 * @since 7 111 */ 112 onCancel(event: () => void): ImageAnimatorAttribute; 113 114 /** 115 * Status callback, which is triggered when the animation playback is complete. 116 * @since 7 117 */ 118 onFinish(event: () => void): ImageAnimatorAttribute; 119} 120 121declare const ImageAnimator: ImageAnimatorInterface; 122declare const ImageAnimatorInstance: ImageAnimatorAttribute; 123