card_mod:
style: |
ha-state-icon {
{% if is_state('switch.ventilator','on') %}
animation: spin 1s linear infinite;
{% else %}
{% endif %}
}
You only need this.
try like this.
card_mod:
style: |
ha-card {
border: inset gold;
background-color: rgb( 255 215 0 / 0.1);
}
ha-state-icon {
{% if states('timer.waschmaschine')!= 'idle' %}
animation: shake 400ms ease-in-out infinite, drum 2s ease infinite;
transform-origin: 50% 110%;
{% else %}
{% endif %}
}
@keyframes shake {
0%, 100% { transform: translate(0, 0) rotate(0); }
20% { transform: translate(0.4px, -0.4px) rotate(-4deg); }
40% { transform: translate(-0.4px, 0.4px) rotate(4deg); }
60% { transform: translate(0.4px, 0.4px) rotate(-4deg); }
80% { transform: translate(-0.4px, -0.4px) rotate(4deg); }
}
@keyframes drum {
50% { clip-path: polygon(0 0, 0 100%, 35% 100%, 34% 68%, 60% 41%, 71% 56%, 65% 74%, 47% 79%, 32% 69%, 35% 100%, 100% 100%, 100% 0); }
}