人形闪烁图标:匹配状态闪烁动画,并改变颜色
type: custom:button-card
entity: input_boolean.ceshi3
name: 人形图标闪烁
show_icon: false
show_state: true
styles:
grid:
- grid-template-areas: |
"icon n"
"icon s"
- grid-template-rows: min-content min-content
- grid-template-columns: min-content min-content
card:
- height: 56px
- padding: 10px
name:
- justify-self: start;
- font-size: 14px
- font-weight: 600
state:
- justify-self: flex-start
- font-size: 12px
- padding-bottom: 4px
custom_fields:
icon:
- width: 30px
- padding-left: 5px
- padding-right: 8px
custom_fields:
icon: |
[[[
return `
<svg viewBox="0 0 25 25">
<style>
@keyframes blink-on {
0%, 100% {
opacity: 0.3;
transform: scale(1);
}
50% {
opacity: 1;
transform: scale(1.1);
}
}
.on {
animation: blink-on 1s infinite;
transform-origin: center;
fill: #5daeea;
}
</style>
<path fill="#9da0a2" class="${entity.state === 'on' ? 'on light-color' : 'light-color'}" d="M13.5,5.5C14.59,5.5 15.5,4.58 15.5,3.5C15.5,2.38 14.59,1.5 13.5,1.5C12.39,1.5 11.5,2.38 11.5,3.5C11.5,4.58 12.39,5.5 13.5,5.5M9.89,19.38L10.89,15L13,17V23H15V15.5L12.89,13.5L13.5,10.5C14.79,12 16.79,13 19,13V11C17.09,11 15.5,10 14.69,8.58L13.69,7C13.29,6.38 12.69,6 12,6C11.69,6 11.5,6.08 11.19,6.08L6,8.28V13H8V9.58L9.79,8.88L8.19,17L3.29,16L2.89,18L9.89,19.38Z"/>
</svg>
`;
]]]
|