1 #include "../lv_examples.h"
2 #if LV_BUILD_EXAMPLES && LV_USE_BTN && LV_USE_LABEL
3
4 /**
5 * Opacity and Transformations
6 */
lv_example_style_15(void)7 void lv_example_style_15(void)
8 {
9 lv_obj_t * btn;
10 lv_obj_t * label;
11
12 /*Normal button*/
13 btn = lv_btn_create(lv_scr_act());
14 lv_obj_set_size(btn, 100, 40);
15 lv_obj_align(btn, LV_ALIGN_CENTER, 0, -70);
16
17 label = lv_label_create(btn);
18 lv_label_set_text(label, "Normal");
19 lv_obj_center(label);
20
21 /*Set opacity
22 *The button and the label is rendered to a layer first and that layer is blended*/
23 btn = lv_btn_create(lv_scr_act());
24 lv_obj_set_size(btn, 100, 40);
25 lv_obj_set_style_opa(btn, LV_OPA_50, 0);
26 lv_obj_align(btn, LV_ALIGN_CENTER, 0, 0);
27
28 label = lv_label_create(btn);
29 lv_label_set_text(label, "Opa:50%");
30 lv_obj_center(label);
31
32 /*Set transformations
33 *The button and the label is rendered to a layer first and that layer is transformed*/
34 btn = lv_btn_create(lv_scr_act());
35 lv_obj_set_size(btn, 100, 40);
36 lv_obj_set_style_transform_angle(btn, 150, 0); /*15 deg*/
37 lv_obj_set_style_transform_zoom(btn, 256 + 64, 0); /*1.25x*/
38 lv_obj_set_style_transform_pivot_x(btn, 50, 0);
39 lv_obj_set_style_transform_pivot_y(btn, 20, 0);
40 lv_obj_set_style_opa(btn, LV_OPA_50, 0);
41 lv_obj_align(btn, LV_ALIGN_CENTER, 0, 70);
42
43 label = lv_label_create(btn);
44 lv_label_set_text(label, "Transf.");
45 lv_obj_center(label);
46 }
47
48 #endif
49