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