1from imagetools import get_png_info, open_png
2
3# Register PNG image decoder
4decoder = lv.img.decoder_create()
5decoder.info_cb = get_png_info
6decoder.open_cb = open_png
7
8anim_imgs = [None]*3
9# Create an image from the png file
10try:
11    with open('../../assets/animimg001.png','rb') as f:
12        anim001_data = f.read()
13except:
14    print("Could not find animimg001.png")
15    sys.exit()
16
17anim_imgs[0] = lv.img_dsc_t({
18  'data_size': len(anim001_data),
19  'data': anim001_data
20})
21
22try:
23    with open('../../assets/animimg002.png','rb') as f:
24        anim002_data = f.read()
25except:
26    print("Could not find animimg002.png")
27    sys.exit()
28
29anim_imgs[1] = lv.img_dsc_t({
30  'data_size': len(anim002_data),
31  'data': anim002_data
32})
33
34try:
35    with open('../../assets/animimg003.png','rb') as f:
36        anim003_data = f.read()
37except:
38    print("Could not find animimg003.png")
39    sys.exit()
40
41anim_imgs[2] = lv.img_dsc_t({
42  'data_size': len(anim003_data),
43  'data': anim003_data
44})
45
46animimg0 = lv.animimg(lv.scr_act())
47animimg0.center()
48animimg0.set_src(anim_imgs, 3)
49animimg0.set_duration(1000)
50animimg0.set_repeat_count(lv.ANIM_REPEAT.INFINITE)
51animimg0.start()
52
53
54
55