I want animate a lightning-button-icon as the standard Salesforce refresh button in LWC. I've already seen a related question but the answer was not conclusive, at this point I don't know if it's possible.
<lightning-button-icon icon-name="utility:refresh" alternative-text="Refresh" class="slds-p-around_xx-small" onclick={refreshTable}></lightning-button-icon>
I've tried using the icon-class atribute but according to the documentation "Only Lightning Design System utility classes are currently supported with icon-class."
I was able to do it in the dev console by adding a breakpoint in refreshTable and edit a class I've created before,
.refreshRotate { animation: rotate .4s linear infinite; }
add " svg". This because if I create the class as "refreshRotate svg {" it doesn't affect the svg. I was then able to toggle it with
e.target.classList.toggle("refreshRotate");
I can't Access the DOM in JS either, other than query selector but since the svg it's not in the same namespace i can't access it.
Any suggestions?