Visualization from cover/blind in a picture-elements

Hello,

I am trying to display a blind in a picture-elements. I use a background picture of my living room and then I took a picture of my living room where the blinds are closed. Then I cut out the closed blinds and created a JPG of them. Now I want to use this picture to visualize the blinds. This means that when the blind is 60% closed, only 60% of the image should be displayed. I have already written the following code, but unfortunately it does not work. The access to the current blind position does not seem to work, because if I enter e.g. 60% instead, only 40% is displayed. Can someone help me?

type: picture-elements
image: /local/Wohnzimmer.jpg # Pfad zum Bild
elements:

  • type: image
    entity: cover.esszimmer_rechts
    image: /local/JalWohn_R_U.jpg
    style:
    left: 50%
    top: 50%
    width: 100%
    height: 100%
    object-fit: cover
    clip-path: >
    {% set position = states.cover.esszimmer_rechts.attributes.current_position | default(0) %}
    inset({{ 100 - position }}% 0 0 0)

Regards,
Frank