SVG Snowflakes

Developer
Size
2,929 Kb
Views
14,168

How do I make an svg snowflakes?

Animation. What is a svg snowflakes? How do you make a svg snowflakes? This script and codes were developed by Veronika on 30 November 2022, Wednesday.

SVG Snowflakes Previews

SVG Snowflakes - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>SVG Snowflakes</title> <meta name="viewport" content="width=device-width, initial-scale=0.65, maximum-scale=1"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <svg xmlns="http://www.w3.org/2000/svg"> <defs> <filter id="f1" x="-50" y="0" width="500px"> <feGaussianBlur in="SourceGraphic" stdDeviation="2" /> </filter> </defs> <g class="snowflake" fill="none" stroke="#fff" stroke-width="8" stroke-linecap="round"> <path transform="translate(150,0) scale(0.4)" d="M55 148.77v-94.2M72.4 138.27l-15.88-16.74M38.74 138.47l15.44-17.14M71.7 63.2L55.8 79.93M38.04 63l15.43 17.14M14.13 124.7l81.83-46.67M31.87 134.62l6.67-22.1M15.02 105.48l22.54 4.92M96.73 96.8l-22.4-5.5M80.23 67.47L73 89.37M14.64 76.67l81.1 47.96M14.82 97l22.5-5.16M31.78 67.92l6.9 22M79.8 134.6l-6.33-22.2M97.1 105.73l-22.6 4.56"/> </g> <g class="snowflake--small" fill="none" stroke="#fff" stroke-width="8" stroke-linecap="round"> <path transform="translate(350,450) scale(0.2)" d="M55 148.77v-94.2M72.4 138.27l-15.88-16.74M38.74 138.47l15.44-17.14M71.7 63.2L55.8 79.93M38.04 63l15.43 17.14M14.13 124.7l81.83-46.67M31.87 134.62l6.67-22.1M15.02 105.48l22.54 4.92M96.73 96.8l-22.4-5.5M80.23 67.47L73 89.37M14.64 76.67l81.1 47.96M14.82 97l22.5-5.16M31.78 67.92l6.9 22M79.8 134.6l-6.33-22.2M97.1 105.73l-22.6 4.56"/> </g> <g class="snowflake--big" fill="none" stroke="#fff" stroke-width="8" stroke-linecap="round"> <path filter="url(#f1)" transform="translate(550, 50) scale(0.6)" d="M55 148.77v-94.2M72.4 138.27l-15.88-16.74M38.74 138.47l15.44-17.14M71.7 63.2L55.8 79.93M38.04 63l15.43 17.14M14.13 124.7l81.83-46.67M31.87 134.62l6.67-22.1M15.02 105.48l22.54 4.92M96.73 96.8l-22.4-5.5M80.23 67.47L73 89.37M14.64 76.67l81.1 47.96M14.82 97l22.5-5.16M31.78 67.92l6.9 22M79.8 134.6l-6.33-22.2M97.1 105.73l-22.6 4.56"/> </g>
</svg> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

SVG Snowflakes - Script Codes CSS Codes

body { width: 100vw; height: 100vh; background: -webkit-linear-gradient(rgb(34, 95, 141), rgb(194, 215, 245)); background: linear-gradient(rgb(34, 95, 141), rgb(194, 215, 245));
}
svg { height: 100%; width: 100%;
}
path { will-change: transform;
}
.snowflake { -webkit-animation: fall 7s infinite linear; animation: fall 7s infinite linear;
}
.snowflake:nth-of-type(10n + 1) { -webkit-animation-delay: 600ms; animation-delay: 600ms;
}
.snowflake:nth-of-type(10n + 2) { -webkit-animation-delay: 1s; animation-delay: 1s;
}
.snowflake:nth-of-type(10n + 3) { -webkit-animation-delay: 1700ms; animation-delay: 1700ms;
}
.snowflake:nth-of-type(10n + 4) { -webkit-animation-delay: 2200ms; animation-delay: 2200ms;
}
.snowflake:nth-of-type(10n + 5) { -webkit-animation-delay: 2700ms; animation-delay: 2700ms;
}
.snowflake:nth-of-type(10n + 6) { -webkit-animation-delay: 3500s; animation-delay: 3500s;
}
.snowflake:nth-of-type(10n + 7) { -webkit-animation-delay: 4200ms; animation-delay: 4200ms;
}
.snowflake:nth-of-type(10n + 8) { -webkit-animation-delay: 4600s; animation-delay: 4600s;
}
.snowflake:nth-of-type(10n + 9) { -webkit-animation-delay: 5400ms; animation-delay: 5400ms;
}
.snowflake--small { -webkit-animation: fall 11s infinite linear; animation: fall 11s infinite linear;
}
.snowflake--small:nth-of-type(10n + 1) { -webkit-animation-delay: 1s; animation-delay: 1s;
}
.snowflake--small:nth-of-type(10n + 2) { -webkit-animation-delay: 2500ms; animation-delay: 2500ms;
}
.snowflake--small:nth-of-type(10n + 3) { -webkit-animation-delay: 4s; animation-delay: 4s;
}
.snowflake--small:nth-of-type(10n + 4) { -webkit-animation-delay: 5200ms; animation-delay: 5200ms;
}
.snowflake--small:nth-of-type(10n + 5) { -webkit-animation-delay: 6500ms; animation-delay: 6500ms;
}
.snowflake--small:nth-of-type(10n + 6) { -webkit-animation-delay: 8s; animation-delay: 8s;
}
.snowflake--small:nth-of-type(10n + 7) { -webkit-animation-delay: 9200ms; animation-delay: 9200ms;
}
.snowflake--small:nth-of-type(10n + 8) { -webkit-animation-delay: 1150ms; animation-delay: 1150ms;
}
.snowflake--small:nth-of-type(10n + 9) { -webkit-animation-delay: 13s; animation-delay: 13s;
}
.snowflake--big { -webkit-animation: fall 4s infinite linear; animation: fall 4s infinite linear;
}
.snowflake--big:nth-of-type(10n + 1) { -webkit-animation-delay: 450ms; animation-delay: 450ms;
}
.snowflake--big:nth-of-type(10n + 2) { -webkit-animation-delay: 720ms; animation-delay: 720ms;
}
.snowflake--big:nth-of-type(10n + 3) { -webkit-animation-delay: 1250ms; animation-delay: 1250ms;
}
.snowflake--big:nth-of-type(10n + 4) { -webkit-animation-delay: 1500ms; animation-delay: 1500ms;
}
.snowflake--big:nth-of-type(10n + 5) { -webkit-animation-delay: 2250ms; animation-delay: 2250ms;
}
.snowflake--big:nth-of-type(10n + 6) { -webkit-animation-delay: 2800ms; animation-delay: 2800ms;
}
.snowflake--big:nth-of-type(10n + 7) { -webkit-animation-delay: 3180ms; animation-delay: 3180ms;
}
.snowflake--big:nth-of-type(10n + 8) { -webkit-animation-delay: 3710ms; animation-delay: 3710ms;
}
.snowflake--big:nth-of-type(10n + 9) { -webkit-animation-delay: 4s; animation-delay: 4s;
}
@-webkit-keyframes fall { 0% { -webkit-transform: translateY(-50vh); transform: translateY(-50vh); } 100% { -webkit-transform: translateY(150vh); transform: translateY(150vh); }
}
@keyframes fall { 0% { -webkit-transform: translateY(-50vh); transform: translateY(-50vh); } 100% { -webkit-transform: translateY(150vh); transform: translateY(150vh); }
}

SVG Snowflakes - Script Codes JS Codes

var windowWidth, random, newPositionX;
var sizeMap = {};
sizeMap['snowflake'] = 0.4;
sizeMap['snowflake--small'] = 0.2;
sizeMap['snowflake--big'] = 0.7;
function randomizeSnowFlake(element, size){ windowWidth = $( window ).width(); randomPosition = Math.random(); newPositionX = windowWidth * randomPosition; console.log(newPositionX); element.find('path').css('transform', `translate(${newPositionX}px,-150px) scale(${size})`);
}
function duplicate(element){ var newSnowFlake, size; size = sizeMap[element.attr('class')]; for(var i = 0; i < 10; i++){ newSnowFlake = element.clone().appendTo('svg'); randomizeSnowFlake(newSnowFlake, size); }
}
(function(){ duplicate($('.snowflake').first()); duplicate($('.snowflake--small').first()); duplicate($('.snowflake--big').first());
})();
SVG Snowflakes - Script Codes
SVG Snowflakes - Script Codes
Home Page Home
Developer Veronika
Username ivhed
Uploaded November 30, 2022
Rating 3
Size 2,929 Kb
Views 14,168
Do you need developer help for SVG Snowflakes?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Veronika (ivhed) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!