mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
40 lines
1.0 KiB
Python
40 lines
1.0 KiB
Python
#
|
|
# Opacity and Transformations
|
|
#
|
|
|
|
# Normal button
|
|
button = lv.button(lv.screen_active())
|
|
button.set_size(100, 40)
|
|
button.align(lv.ALIGN.CENTER, 0, -70)
|
|
|
|
label = lv.label(button)
|
|
label.set_text("Normal")
|
|
label.center()
|
|
|
|
# Set opacity
|
|
# The button and the label is rendered to a layer first and that layer is blended
|
|
button = lv.button(lv.screen_active())
|
|
button.set_size(100, 40)
|
|
button.set_style_opa(lv.OPA._50, 0)
|
|
button.align(lv.ALIGN.CENTER, 0, 0)
|
|
|
|
label = lv.label(button)
|
|
label.set_text("Opa:50%")
|
|
label.center()
|
|
|
|
# Set transformations
|
|
# The button and the label is rendered to a layer first and that layer is transformed
|
|
button = lv.button(lv.screen_active())
|
|
button.set_size(100, 40)
|
|
button.set_style_transform_rotation(150, 0) # 15 deg
|
|
button.set_style_transform_scale(256 + 64, 0) # 1.25x
|
|
button.set_style_transform_pivot_x(50, 0)
|
|
button.set_style_transform_pivot_y(20, 0)
|
|
button.set_style_opa(lv.OPA._50, 0)
|
|
button.align(lv.ALIGN.CENTER, 0, 70)
|
|
|
|
label = lv.label(button)
|
|
label.set_text("Transf.")
|
|
label.center()
|
|
|