just to be 100% clear. not my animation. credit to @rhysb.
What you seem to be missing is that when we have the rotating drum we are actually using 2 chips and overlaying them. currently in your code i see only 1 chip.
so you would need something like this:
type: custom:mushroom-chips-card
chips:
- type: template
- type: template
- type: template
- type: template
- type: template
- type: template
- type: template
- type: entity
entity: switch.office_screen_left
icon: mdi:washing-machine
content_info: none
icon_color: orange
- type: template
icon: mdi:washing-machine
icon_color: orange
card_mod:
style: |
ha-card {
left: -44.5px;
top: 0px;
background: none !important;
border: none !important;
box-shadow: none !important;
}
card_mod:
style:
mushroom-entity-chip:nth-child(8)$: |
ha-state-icon {
{% if is_state('switch.wasmachine','on') %}
animation: shake 400ms ease-in-out infinite;
{% else %}
{% endif %}
transform-origin: 50% 58%;
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);
filter: drop-shadow(2px 2px 3px rgba(var(--rgb-black), 0.4));
}
@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); }
}
mushroom-template-chip:nth-child(9)$: |
ha-state-icon {
{% if is_state('switch.wasmachine','on') %}
animation: spin 1s linear infinite;
{% else %}
{% endif %}
transform-origin: 50% 58%;
clip-path: circle(21.7% at 50% 58%);
}
@keyframes spin {
0% { transform: rotate(0); }
100% { transform: rotate(360deg); }
}
I have put in a bunch of template chips because i noticed that your entity chip is the 8th chip.
Keep in mind that this code provided only works if the chips being overlayed with eachother are next to eachother in the main chip card. if they arent you would need to adjust the values and my recommendation is then to put your chip that is being overlayed at the very end and never put any new chip after it. you can then adjust the left:
amount and set the position: absolute
like this:
type: custom:mushroom-chips-card
chips:
- type: template
- type: entity
entity: switch.office_screen_left
icon: mdi:washing-machine
content_info: none
icon_color: orange
- type: template
- type: template
- type: template
- type: template
- type: template
- type: template
- type: template
icon: mdi:washing-machine
icon_color: orange
card_mod:
style: |
ha-card {
position: absolute;
left: 44.5px;
top: 0px;
background: none !important;
border: none !important;
box-shadow: none !important;
}
card_mod:
style:
mushroom-entity-chip:nth-child(2)$: |
ha-state-icon {
{% if is_state('switch.office_screen_left','on') %}
animation: shake 400ms ease-in-out infinite;
{% else %}
{% endif %}
transform-origin: 50% 58%;
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);
filter: drop-shadow(2px 2px 3px rgba(var(--rgb-black), 0.4));
}
@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); }
}
mushroom-template-chip:nth-child(9)$: |
ha-state-icon {
{% if is_state('switch.office_screen_left','on') %}
animation: spin 1s linear infinite;
{% else %}
{% endif %}
transform-origin: 50% 58%;
clip-path: circle(21.7% at 50% 58%);
}
@keyframes spin {
0% { transform: rotate(0); }
100% { transform: rotate(360deg); }
}