From 340d45cfa91b7108d43af906fc51b1c431877827 Mon Sep 17 00:00:00 2001 From: "Andres O. Vela" Date: Fri, 25 Feb 2022 11:54:27 +0100 Subject: [PATCH] feat(label): added animation style property to apply it to circular scrolling animation of label widget (#3128) * feat(label): added animation style property to apply it to circular scrolling animation of label widget Added an animation style property to be used as animation template for different use cases in different widgets. This commit implements using this property to set the start and repeat delay of the circular scrolling animation of the label widget. Closes #3097 * fix(label): changed animation style property's var_type to `const lv_anim_t *` * example(label): added example showing how to customize circular scrolling animation * chore(label): ran code-format.py and added missing function prototype to lv_example_widgets.h --- docs/overview/style-props.md | 11 ++++++- docs/widgets/core/label.md | 4 +++ examples/widgets/label/index.rst | 6 ++++ examples/widgets/label/lv_example_label_5.c | 30 ++++++++++++++++++++ examples/widgets/label/lv_example_label_5.py | 10 +++++++ examples/widgets/lv_example_widgets.h | 1 + scripts/style_api_gen.py | 4 +++ src/core/lv_obj_style_gen.c | 8 ++++++ src/core/lv_obj_style_gen.h | 7 +++++ src/misc/lv_style.h | 13 +++++---- src/misc/lv_style_gen.c | 8 ++++++ src/misc/lv_style_gen.h | 6 ++++ src/widgets/lv_label.c | 21 +++++++++++--- 13 files changed, 118 insertions(+), 11 deletions(-) create mode 100644 examples/widgets/label/lv_example_label_5.c create mode 100644 examples/widgets/label/lv_example_label_5.py diff --git a/docs/overview/style-props.md b/docs/overview/style-props.md index 3eeaa8dd0..ed924ee99 100644 --- a/docs/overview/style-props.md +++ b/docs/overview/style-props.md @@ -253,7 +253,7 @@ Set the point from which the background's gradient color should start. 0 means t ### bg_grad -Set the gradient definition. The pointed instance must exist while the object is alive. NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and `BG_GRAD_STOP` into one descriptor and allows craeting gradients with more colors too. +Set the gradient definition. The pointed instance must exist while the object is alive. NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors too. +### anim +The animation template for the object's animation. Should be a pointer to `lv_anim_t`. The animation parameters are widget specific, e.g. animation time could be the E.g. blink time of the cursor on the text area or scroll time of a roller. See the widgets' documentation to learn more. + + ### anim_time The animation time in milliseconds. Its meaning is widget specific. E.g. blink time of the cursor on the text area or scroll time of a roller. See the widgets' documentation to learn more.