Skip to content

Instantly share code, notes, and snippets.

@liquidcarbon
Last active July 10, 2025 14:51
Show Gist options
  • Select an option

  • Save liquidcarbon/5d7bed9c2da30004a90ef5b7e7d8f363 to your computer and use it in GitHub Desktop.

Select an option

Save liquidcarbon/5d7bed9c2da30004a90ef5b7e7d8f363 to your computer and use it in GitHub Desktop.
SVG with CSS animation
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8"?>
<svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg">
<style>
.circle {
fill: orange;
animation: pulse 1.5s infinite ease-in-out;
animation-play-state: running;
transform-origin: center;
}
svg:hover .circle {
animation-play-state: paused;
}
@keyframes pulse {
0%, 100% {
r: 20;
opacity: 0.8;
}
50% {
r: 60;
opacity: 0.2;
}
}
</style>
<circle class="circle" cx="60" cy="60" r="20" />
<text x="15" y="60">hover to pause</text>
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment