display:
  - platform: sdl
    id: sdl0
    auto_clear_enabled: false
    dimensions:
      width: 480
      height: 320
  - platform: sdl
    id: sdl1
    dimensions:
      width: 480
      height: 480

touchscreen:
  - platform: sdl
    display: sdl0
    sdl_id: sdl0

lvgl:
  - id: lvgl_0
    default_font: space16
    displays: sdl0
    rotation: 180
    top_layer:
    widgets:
      - obj:
          id: anim_box
          x: 0
          y: 0
          width: 40
          height: 40
          bg_color: 0xFF0000
    animations:
      - id: anim_slide
        duration: 1s
        start_delay: 100ms
        auto_start: true
        loop: true
        timing:
          - round_trip
          - type: ease_in_out
            weight: 0.5
        on_start:
          - logger.log: anim started
        on_stop:
          - logger.log: anim stopped
        widgets:
          - id: anim_box
            x:
              from: 0
              to: !lambda "return 100;"
            opa:
              from: 50%
              to: 100%

  - id: lvgl_1
    displays: sdl1
    on_idle:
      timeout: 8s
      then:
        if:
          condition:
            lvgl.is_idle:
              lvgl_id: lvgl_1
              timeout: 5s
          then:
            logger.log: Lvgl2 is idle
    widgets:
      - button:
          align: center
          widgets:
            - label:
                text: Click ME
          on_click:
            then:
              - logger.log: Clicked
              - lvgl.animation.stop:
                  id: anim_slide
                  lvgl_id: lvgl_0
              - lvgl.animation.start:
                  id: anim_slide
                  lvgl_id: lvgl_0

font:
  - file: "gfonts://Roboto"
    id: space16
    bpp: 4
