I need to make text catch attention by flashing between yellow and black. How can I do this?
Within SquareLine Studio you can only make an ‘opacity’ animation, no ‘color’ animation currently, it still gives a nice smooth flashing. For color-switching you’ll need a custom code in the exported code. To have a steady blinking/flashing rate it’s best if you create a timer callback first ( Timers — LVGL documentation ), then toggle the color of the label in it with something like lv_obj_set_style_text_color( labelpointer, color, LV_PART_MAIN | LV_STATE_DEFAULT )
give me a example with code:
Put this into your main loop (change ui_Label1 as needed):
static signed char BlinkCounter;
lv_obj_set_style_text_color( ui_Label1, lv_color_hex( ++BlinkCounter >= 0 ? 0x000000 : 0xFFFF00 ), LV_PART_MAIN | LV_STATE_DEFAULT );
Thanks Hermit.
1 Like