I’m wondering if its possible to do two things on a tap_action
. I’d like to call a service and change a CSS variable. I have the following SVG icon I’d like to animate (I’ve wrapped it in some HTML to load in a webpage for testing)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style>
svg {
--up-or-down: translateY(-50%);
}
div {width: 300px;}
</style>
<body>
<div>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<defs>
<clipPath id="doorClip">
<rect x="0" y="10" width="20" height="14"/>
</clipPath>
</defs>
<g clip-path="url(#doorClip)">
<path style="transition: 4.4s linear; transform: var(--up-or-down)" d="M4.999 17.991h14v-2h-14v2zm0 3h14v-2h-14v2zm0 2.5a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-1.5h-14v1.5zm13.5-10.5h-13a.5.5 0 00-.5.5v1.5h14v-1.5a.5.5 0 00-.5-.5z"/></g>
<path d="M23.853 11.137L13.206.491c-.643-.644-1.767-.645-2.413 0L.146 11.138a.499.499 0 00.354.854H2v11.5a.5.5 0 00.5.5h1a.5.5 0 00.5-.5v-10c0-.827.673-1.5 1.5-1.5h13c.827 0 1.5.673 1.5 1.5v10a.5.5 0 00.5.5h1a.5.5 0 00.5-.5V11.991h1.5a.5.5 0 00.353-.854z"/></svg>
</div>
</body>
</html>
Just change the var from -50% to 0 and vice-versa to see the garage door go up or down.