Skip to content

Commit 29beaf7

Browse files
More animation tests
1 parent ba7c8c2 commit 29beaf7

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

draft_code/animations.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,56 @@
236236

237237
#lvgl.anim_timeline_start( time )
238238

239+
240+
241+
242+
***************** clicking the button starts the animation:
243+
244+
245+
246+
247+
# Initialize
248+
249+
import display_driver
250+
import lvgl as lv
251+
252+
253+
label = lv.label( lv.screen_active() )
254+
label.set_text( 'hi' )
255+
256+
animation = lv.anim_t()
257+
animation.init()
258+
animation.set_var( label )
259+
animation.set_values( 0, 100 )
260+
animation.set_time( 1000 )
261+
262+
animation.set_custom_exec_cb( lambda not_used, value : label.set_x( value ))
263+
264+
#wait half a second before starting animation
265+
#animation.set_delay( 500 )
266+
267+
#play animation backward for 1 second after first play
268+
#animation.set_playback_time( 1000 )
269+
#repeat animation infinitely
270+
#animation.set_repeat_count( 10 )
271+
#animation.set_repeat_count( lvgl.ANIM_REPEAT.INFINITE )
272+
#animation.set_repeat_delay( 500 )
273+
274+
button = lv.button(lv.screen_active())
275+
button.set_size(60,30)
276+
button.center()
277+
#button.set_pos(100,100)
278+
wifi_label=lv.label(button)
279+
wifi_label.set_text(lv.SYMBOL.WIFI+" WiFi")
280+
wifi_label.center()
281+
#wifi_label.set_style_text_color(COLOR_DRAWER_BUTTONTEXT,0)
282+
283+
def wifi_event(e):
284+
animation.start()
285+
286+
button.add_event_cb(wifi_event,lv.EVENT.CLICKED,None)
287+
288+
289+
290+
291+

0 commit comments

Comments
 (0)