SVG stands for Scalable Vector Graphics and is used for vector-based graphics in XML format. What stands out the most about SVGs is that every element included in the SVG files can be manipulated in some way and the graphics do not lose their quality upon any sort of manipulation. Furthermore, it is also a W3C recommendation which indicates that a specification is stable, contributes to Web interoperability, and has been reviewed by the W3C Membership, who favour the widespread adoption.
Since I was creating a portfolio website from scratch I decided to learn how to animate SVG and create my own animation using it. This post will be detail of the complete creation process of the animated SVG which will be used the center of of the website on the first page.
As the portfolio will follow a minimalistic design, one way in which it could really pop-up will be through the use of geometrical shapes. Simple shapes used repetitively can create a pattern that is visually appealing and when the patterns are animated they easily grab the attention of the user especially in a minimalistic background.
Hence, I started off with a simple equilateral triangle which then I played around and animated to try and find out how in many ways can it be animated which resulted in the following:
To start off, I had to get the SVG of all the triangles in the correct position:
There are multiple ways of getting an SVG of a digital design you have created. You can use platforms like Adobe Illustrator or Inkscape to create the SVG files by exporting to SVG or you can convert the image files (jpeg, png, tiff) into SVG files online. Since I did not have both Illustrator or Inkscape, I decided to convert the png files of the triangles that I had saved in their original starting positions. After converting I got the following SVG file, one for each triangle:
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" type="text/css" href="main.css">
<title>Document</title>
</head>
<body>
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" width="300.000000pt" height="225.000000pt" viewBox="0 0 300.000000 225.000000" preserveAspectRatio ="xMidYMid meet">
<g transform="translate(0.000000,225.000000)scale(0.100000,-0.100000)" fill="#000000" stroke="none">
<path d="M1295 1170 c-174 -174 -206 -210 -190 -216 87 -34 601 -200 603 -195
1 3 -44 144 -101 314 l-102 307 -210 -210z m296 -97 c50 -153 94 -283 96 -290
3 -6 -126 32 -286 85 l-291 97 192 192 c106 106 194 193 195 193 1 0 43 -125
94 -277z"/>
</g>
</svg>
</body>
</html>
From the code above, all that is encapsulated in the element tag <g> is the actual defined vector that will be worked on. As all the triangles had different SVG files and needed to be incorporated into the same SVG section, I copied the details of the tag <g> for each triangle into a single SVG file and gave them an id so that the elements in SVG can be referenced in the CSS file and manipulated.
<g id='triangle_1' transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">
...
<g id='triangle_2' transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">
...
<g id='triangle_3' transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">
...
<g id='triangle_4' transform="translate(0.000000,225.000000) scale(0.100000,-0.100000)" fill="#000000" stroke="none">






