SVG Heart Animation
How do I make an svg heart animation?
Just playing around with loops and Snap.svg. What is a svg heart animation? How do you make a svg heart animation? This script and codes were developed by Andreas Neeven on 18 September 2022, Sunday.
SVG Heart Animation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>SVG Heart Animation</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrapper"> <div class="I">I</div>
<svg version="1.1" id="heart" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100px" height="100px" viewBox="0 0 100 100" enable-background="new 0 0 100 100" xml:space="preserve">
<rect id="pxl-1" x="25" y="20" width="10" height="10"/>
<rect id="pxl-2" x="35" y="20" width="10" height="10"/>
<rect id="pxl-3" x="55" y="20" width="10" height="10"/>
<rect id="pxl-4" x="65" y="20" width="10" height="10"/>
<rect id="pxl-5" x="15" y="30" width="10" height="10"/>
<rect id="pxl-6" x="25" y="30" width="10" height="10"/>
<rect id="pxl-7" x="35" y="30" width="10" height="10"/>
<rect id="pxl-8" x="45" y="30" width="10" height="10"/>
<rect id="pxl-9" x="55" y="30" width="10" height="10"/>
<rect id="pxl-10" x="65" y="30" width="10" height="10"/>
<rect id="pxl-11" x="75" y="30" width="10" height="10"/>
<rect id="pxl-12" x="15" y="40" width="10" height="10"/>
<rect id="pxl-13" x="25" y="40" width="10" height="10"/>
<rect id="pxl-14" x="35" y="40" width="10" height="10"/>
<rect id="pxl-15" x="45" y="40" width="10" height="10"/>
<rect id="pxl-16" x="55" y="40" width="10" height="10"/>
<rect id="pxl-17" x="65" y="40" width="10" height="10"/>
<rect id="pxl-18" x="75" y="40" width="10" height="10"/>
<rect id="pxl-19" x="25" y="50" width="10" height="10"/>
<rect id="pxl-20" x="35" y="50" width="10" height="10"/>
<rect id="pxl-21" x="45" y="50" width="10" height="10"/>
<rect id="pxl-22" x="55" y="50" width="10" height="10"/>
<rect id="pxl-23" x="65" y="50" width="10" height="10"/>
<rect id="pxl-24" x="35" y="60" width="10" height="10"/>
<rect id="pxl-25" x="45" y="60" width="10" height="10"/>
<rect id="pxl-26" x="55" y="60" width="10" height="10"/>
<rect id="pxl-27" x="45" y="70" width="10" height="10"/>
</svg> <div class="CodePen">CODEPEN</div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.3.0/snap.svg-min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
SVG Heart Animation - Script Codes CSS Codes
body { position: absolute; width: 100%; height: 100%; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; background: #333;
}
.wrapper { display: -webkit-box; display: -ms-flexbox; display: flex;
}
.wrapper .I,
.wrapper .CodePen { font-size: 70px; color: black;
}
#heart { -webkit-transform: scale(1.5); transform: scale(1.5); margin: 0 25px 0 25px;
}
SVG Heart Animation - Script Codes JS Codes
var snap = Snap.select('#heart');
var pxls = $('#heart rect').length;
for( var i = 1; i <= pxls; i++ ) { /* Random Colors */ snap.select('#pxl-' + i).attr({fill: '#000000'}).animate({fill: (function(m,s,c){return (c ? arguments.callee(m,s,c-1) : '#') + s[m.floor(m.random() * s.length)]})(Math,'0123456789ABCDEF',5)}, 500*i, mina.easeinout); /* Red */
/* snap.select('#pxl-' + i).attr({fill: '#000000'}).animate({fill: 'red'}, 500*i, mina.easeinout);*/
}
Developer | Andreas Neeven |
Username | aneeven |
Uploaded | September 18, 2022 |
Rating | 3 |
Size | 2,753 Kb |
Views | 24,288 |
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!
Name | Size |
Flexbox align | 2,098 Kb |
Mail Element Concept | 3,609 Kb |
Yet another card... | 3,819 Kb |
Fun stuff with transforms, transitions and border radius | 2,865 Kb |
Menubar blur content | 3,942 Kb |
Spinning Loader | 10,644 Kb |
Neon Hexagons SVG Image-Fill | 2,928 Kb |
Digital Sucks | 2,769 Kb |
Yay for blend-modes | 2,443 Kb |
Flexbox grow, shrink and basis | 2,305 Kb |
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!
Name | Username | Size |
Rrremark.com Overlay Highlighter | Derickruiz | 4,438 Kb |
A Pen by Shidhin | Shidhincr | 5,015 Kb |
Hovers with popups | Zacharyolson | 2,380 Kb |
Save for later... | Victorfreire | 1,359 Kb |
Flexbox Test | Icutpeople | 2,486 Kb |
Display properties | Hamzaerbay | 1,886 Kb |
Random Gradients - JS | Aldlevine | 2,026 Kb |
Halo 5 REQ Guide Bookmarklet | Cwacht | 3,993 Kb |
Kudos Please | TimPietrusky | 6,624 Kb |
ASCII triangle image overlay | Mitchdot | 2,200 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!