Created
January 3, 2021 07:39
-
-
Save Climber24/c24cf74fee2d4f2845f3b72f39794988 to your computer and use it in GitHub Desktop.
An example of SVG animated with CSS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Пример зацикленной SVG-анимации, заданной в CSS</title> | |
</head> | |
<body> | |
<style> | |
* { | |
margin: 0; | |
padding: 0; | |
} | |
h1 { | |
font-size: 7vh; | |
text-align: center; | |
color: rgb(0, 56, 28); | |
margin: 3vh; | |
} | |
.svg-container { | |
display: flex; | |
} | |
svg { | |
margin: 0 auto; | |
border: 0.5vh solid rgb(0, 56, 28); | |
width:90%; | |
height: 80vh; | |
fill: none; | |
border-radius: 5vw; | |
} | |
svg circle { | |
cx: 50%; | |
cy: 50%; | |
r: 80vmax; | |
stroke-width: 40vmax; | |
animation: scaling-down 4s infinite linear; | |
transform-origin: 50% 50%; | |
stroke-dasharray: 10%; | |
} | |
svg circle:first-child { | |
stroke: rgb(0, 65, 32); | |
} | |
svg circle:nth-child(2) { | |
animation-delay: 2s; | |
stroke: rgb(226, 18, 3); | |
} | |
@keyframes scaling-down { | |
50% { | |
stroke-opacity: 1; | |
} | |
90% { | |
stroke-opacity: 0; | |
} | |
100% { | |
stroke-opacity: 0; | |
transform: rotate(180deg) scale(0); | |
} | |
} | |
</style> | |
<h1>Пример зацикленной SVG-анимации, заданной в CSS</h1> | |
<div class="svg-container"> | |
<svg stroke="black"> | |
<circle> | |
</circle> | |
<circle> | |
</circle> | |
</svg> | |
</div> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment