Web Development Kodex

animated svg polygon

index.html

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Animated SVG Polygon</title>
<meta name="robots" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<h1>Animated SVG Polygon</h1>
</header>
<div class="wrapper">
<div class="container">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 566 491" style="enable-background:new 0 0 566 491;" xml:space="preserve">
<polygon points="450.5,354.5 130.5,367.5 73.5,106.5 405.5,122.5 "><animate attributeName="points" to="353,287 213,307 167,157 351,166" dur="800ms" begin="200ms" fill="freeze"></animate></polygon>
</svg>
</div>
<!-- .container-->
</div>
<!-- .wrapper-->
<footer>
<small><a href="https://opensource.org/licenses/MIT">MIT</a></small>
</footer>
</body>
</html>

styles.css

body {
background: #eeeeee;
font-size: 16px;
font-family: "Trebuchet MS", Helvetica, sans-serif;
margin: 0;
}
a {
color: crimson;
text-decoration: none;
}
a:hover {
color: red;
}
/* Layout
------------------------------------------*/
header,
.container,
footer {
margin: 0 auto;
width: 88%;
max-width: 1080px;
}
.wrapper {
padding: 1em 0;
background: #ffffff;
}