| 12345678910111213141516171819202122 |
- local line_demo = {}
- function line_demo.demo()
- --Create an array for the points of the line
- local line_points = { {5, 5}, {70, 70}, {120, 10}, {180, 60}, {240, 10} };
- --Create style
- local style_line = lvgl.style_t();
- lvgl.style_init(style_line);
- lvgl.style_set_line_width(style_line, lvgl.STATE_DEFAULT, 8);
- lvgl.style_set_line_color(style_line, lvgl.STATE_DEFAULT, lvgl.color_make(0x00, 0x00, 0xFF));
- lvgl.style_set_line_rounded(style_line, lvgl.STATE_DEFAULT, true);
- --Create a line and apply the new style
- local line1;
- line1 = lvgl.line_create(lvgl.scr_act(), nil);
- lvgl.line_set_points(line1, line_points, 5); --Set the points
- lvgl.obj_add_style(line1, lvgl.LINE_PART_MAIN, style_line); --Set the points
- lvgl.obj_align(line1, nil, lvgl.ALIGN_CENTER, 0, 0);
- end
- return line_demo
|