hehe… here you go
icon_cover_animate:
styles:
custom_fields:
icon:
- width: 80%
- fill: >
[[[
return (variables.state_on || variables.current_tilt_position !== 0 )
? '#3182b7'
: '#9da0a2';
]]]
custom_fields:
icon: >
[[[
let state;
if (variables.state === 'opening' && variables.timeout < 50000) {
state = 'on';
}
if (variables.state === 'closing' && variables.timeout < 50000 ) {
state = 'off';
}
if (variables.state_on && variables.timeout > 50000) {
state = 'on_timeout';
}
let style =
`
<style>
@keyframes on {
from {
transform: scaleY(0);
}
to {
transform: scaleY(1);
}
}
@keyframes off {
from {
transform: scaleY(1);
}
to {
transform: scaleY(0);
}
}
.on {
animation: off 10s ease-in infinite;
}
.off {
animation: on 10s ease-out infinite;
}
</style>
`,
ram =
`
<g id="ram" opacity="0.6">
<path d="M1.77,28.03c.78,0,1.41-.64,1.41-1.4s-.63-1.4-1.41-1.4-1.39,.62-1.39,1.4,.62,1.4,1.39,1.4Z" />
<path d="M1.77,18.34c.78,0,1.41-.64,1.41-1.4s-.63-1.39-1.41-1.39-1.39,.62-1.39,1.39,.62,1.4,1.39,1.4Z" />
<path d="M1.77,23.19c.78,0,1.41-.66,1.41-1.41s-.63-1.39-1.41-1.39-1.39,.62-1.39,1.39,.62,1.41,1.39,1.41Z" />
<path
d="M1.77,34.92c-.85,0-1.55,.72-1.55,1.56v5.07c0,.85,.7,1.56,1.55,1.56s1.56-.71,1.56-1.56v-5.07c0-.85-.69-1.56-1.56-1.56Z" />
<path d="M1.77,8.65c.78,0,1.41-.65,1.41-1.41s-.63-1.39-1.41-1.39-1.39,.61-1.39,1.39,.62,1.41,1.39,1.41Z" />
<path d="M1.77,13.49c.78,0,1.41-.63,1.41-1.39s-.63-1.41-1.41-1.41-1.39,.62-1.39,1.41,.62,1.39,1.39,1.39Z" />
<path d="M1.77,32.86c.78,0,1.41-.64,1.41-1.39s-.63-1.39-1.41-1.39-1.39,.62-1.39,1.39,.62,1.39,1.39,1.39Z" />
<path d="M42.5,0H1.77C.8,0,0,.81,0,1.78s.8,1.78,1.77,1.78H42.5c.98,0,1.78-.8,1.78-1.78s-.8-1.78-1.78-1.78Z" />
</g>
`,
opened =
`
<path id="open1"
d="M41.71,5.95H10.2c-1,0-1.66,.23-2.24,.77l-1.87,1.86c-.66,.64-.42,1.87,.67,1.87h31.53c1,0,1.66-.23,2.24-.77l1.87-1.87c.66-.64,.42-1.86-.69-1.86Z" />
<path id="open2"
d="M41.71,16.71H10.2c-1,0-1.66,.22-2.24,.77l-1.87,1.87c-.66,.63-.42,1.84,.67,1.84h31.53c1,0,1.66-.22,2.24-.77l1.87-1.87c.66-.62,.42-1.84-.69-1.84Z" />
<path id="open3"
d="M41.71,38.17H10.2c-1,0-1.66,.23-2.24,.79l-1.87,1.86c-.66,.62-.42,1.87,.67,1.87h31.53c1,0,1.66-.25,2.24-.8l1.87-1.85c.66-.64,.42-1.86-.69-1.86Z" />
<path id="open4"
d="M41.71,27.45H10.2c-1,0-1.66,.22-2.24,.77l-1.87,1.87c-.66,.64-.42,1.86,.67,1.86h31.53c1,0,1.66-.25,2.24-.79l1.87-1.86c.66-.62,.42-1.85-.69-1.85Z" />
`,
closed =
`
<path id="closed1"
d="M41.08,6.05H7.56c-.97,0-1.59,.63-1.59,1.55v4.75c0,.94,.64,1.55,1.59,1.55H41.08c.99,0,1.59-.63,1.59-1.57V7.59c0-.93-.62-1.54-1.59-1.54Z" />
<path id="closed2"
d="M41.08,25.46H7.56c-.95,0-1.59,.63-1.59,1.53v4.77c0,.93,.62,1.55,1.59,1.55H41.08c.99,0,1.59-.62,1.59-1.55v-4.78c0-.89-.6-1.51-1.59-1.51Z" />
<path id="closed3"
d="M41.08,35.17H7.56c-.98,0-1.58,.61-1.58,1.55v4.73c0,.94,.6,1.56,1.57,1.56H41.06c.97,0,1.61-.62,1.61-1.56v-4.73c0-.95-.62-1.55-1.59-1.55Z" />
<path id="closed4"
d="M41.1,15.76H7.56c-.95,0-1.59,.63-1.59,1.54v4.77c0,.91,.62,1.52,1.59,1.52H41.09c.96,0,1.58-.62,1.58-1.52v-4.79c0-.9-.62-1.52-1.58-1.52Z" />
`;
if (variables.state_on || variables.current_tilt_position == 100 && variables.current_position == 0)
return `
<svg viewBox="0 0 50 50">
${style}
${ram}
<g class="${state}" id="open">
${opened}
</g>
</svg>`;
else return `
<svg viewBox="0 0 50 50">
${style}
${ram}
<g>
${closed}
</g>
</svg>`;
]]]