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 */
15import ComponentConfig from './ComponentConfig';
16
17/**
18 * ImageAnimator component
19 */
20@Component
21export default struct ImageAnimatorComponent {
22  private imageWidth: number | Resource = 0
23  private imageHeight: number | Resource = 0
24  private whtl: number | string = ComponentConfig.value_20;
25
26  build() {
27    Column() {
28      ImageAnimator()
29        .images([
30          {
31            src: 'res/image/xxxhdpi/ic_loading01.png',
32            duration: ComponentConfig.DURATION_TIME,
33            width: this.whtl,
34            height: this.whtl,
35            top: this.whtl,
36            left: this.whtl
37          },
38          {
39            src: 'res/image/xxxhdpi/ic_loading02.png',
40            duration: ComponentConfig.DURATION_TIME,
41            width: this.whtl,
42            height: this.whtl,
43            top: this.whtl,
44            left: this.whtl
45          },
46          {
47            src: 'res/image/xxxhdpi/ic_loading03.png',
48            duration: ComponentConfig.DURATION_TIME,
49            width: this.whtl,
50            height: this.whtl,
51            top: this.whtl,
52            left: this.whtl
53          },
54          {
55            src: 'res/image/xxxhdpi/ic_loading04.png',
56            duration: ComponentConfig.DURATION_TIME,
57            width: this.whtl,
58            height: this.whtl,
59            top: this.whtl,
60            left: this.whtl
61          },
62          {
63            src: 'res/image/xxxhdpi/ic_loading05.png',
64            duration: ComponentConfig.DURATION_TIME,
65            width: this.whtl,
66            height: this.whtl,
67            top: this.whtl,
68            left: this.whtl
69          },
70          {
71            src: 'res/image/hdpi/ic_loading06.png',
72            duration: ComponentConfig.DURATION_TIME,
73            width: this.whtl,
74            height: this.whtl,
75            top: this.whtl,
76            left: this.whtl
77          }])
78        .width(this.imageWidth)
79        .height(this.imageHeight)
80        .iterations(-1)
81        .fixedSize(true)
82        .reverse(true)
83        .fillMode(FillMode.None)
84        .state(AnimationStatus.Running)
85    }
86  }
87}