MorphSVG Fruit
How do I make an morphsvg fruit?
What is a morphsvg fruit? How do you make a morphsvg fruit? This script and codes were developed by Veronika on 30 November 2022, Wednesday.
MorphSVG Fruit - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>MorphSVG Fruit</title> <link href="https://fonts.googleapis.com/css?family=Comfortaa" rel="stylesheet"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600"> <path id="apple" d="M391.4 181s-20-105.8 103-100c-12 99.2-103 100-103 100zm-6.8 23c4 0 5.3-149-48-111.7m145.8 88c-26 0-58 7.8-96.7 26.3-168-86.3-222.5 65.2-205.7 145.8 25.2 121.3 121.5 157.6 205.7 157 90.3-.4 175.8-30.8 200-165.6 10.2-56.6-5.8-164-103.3-163.6z"/> <path id="banana" d="M129.2 356.3c-7-1-5 20.8-5 20.8s-19.8 5.8-15.4 10.8c68 77 241.3 140.5 370 47.5C580.4 361.5 604.5 292.7 613.2 204c2-20.6-20-58.8-20-58.8l9.5-40.5-16-10-16.5 47S547 155 525 178c-37 41.4-25.5 93.3-117 159.7-103.3 74.8-179.8 32-278.8 18.6z"/> <path id="fruit" d="M129.2 356.3c-7-1-5 20.8-5 20.8s-19.8 5.8-15.4 10.8c68 77 241.3 140.5 370 47.5C580.4 361.5 604.5 292.7 613.2 204c2-20.6-20-58.8-20-58.8l9.5-40.5-16-10-16.5 47S547 155 525 178c-37 41.4-25.5 93.3-117 159.7-103.3 74.8-179.8 32-278.8 18.6z"/>
</svg>
<button id="changeFruit">Change fruit</buton> <script src='http://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.0/TweenMax.min.js'></script>
<script src='http://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/MorphSVGPlugin.min.js?r=182'></script>
<script src='http://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/findShapeIndex.js?r=19'></script> <script src="js/index.js"></script>
</body>
</html>
MorphSVG Fruit - Script Codes CSS Codes
body { background-color: #FCE6E9;
}
svg { display: block; margin-top: 30px; margin: auto; width: 300px; height: 300px;
}
#fruit { stroke: #FFCB39; stroke-width: 20; fill: transparent;
}
#apple, #banana { visibility: hidden;
}
button { display: block; margin: auto; background-color: transparent; outline: none; border: 4px solid #E43F42; border-radius: 5px; padding: 10px; color: #E43F42; cursor: pointer; font-family: 'Comfortaa', cursive; font-size: 18px; letter-spacing: 1px;
}
MorphSVG Fruit - Script Codes JS Codes
var toAppleTl = new TimelineMax({paused:true});
toAppleTl.to('#fruit', 0.2 , { morphSVG: {shape:'#apple', shapeIndex: 8}, stroke: '#07AD6E', ease: Power0.easeNone
});
document.getElementById('changeFruit').addEventListener('click', () => { if (toAppleTl.time() > 0) { toAppleTl.reverse(); } else { toAppleTl.play(); }
});
Developer | Veronika |
Username | ivhed |
Uploaded | November 30, 2022 |
Rating | 3 |
Size | 2,490 Kb |
Views | 44,528 |
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 |
FreeCodeCamp - Simon Game | 8,481 Kb |
FreeCodeCamp - Pomodoro Clock | 4,937 Kb |
FreeCodeCamp - Javascript Calculator | 3,420 Kb |
CSS Baby | 1,923 Kb |
FreeCodeCamp - Personal Portfolio | 3,262 Kb |
Background blend mode | 1,610 Kb |
CSS Filter Blur | 1,923 Kb |
FreeCodeCamp - Tic Tac Toe Game | 4,469 Kb |
FreeCodeCamp - Twitch.tv | 3,285 Kb |
Space Game Button | 3,321 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 |
Word Wrap Algorithm for Multiline Canvas Text | Peterhry | 2,349 Kb |
Free css icon set v2 - one div | Ben_jammin | 0 Kb |
Starfield using KineticJS | Asp | 3,512 Kb |
Sass random color animation | Jotavejv | 4,827 Kb |
Hc first draft | Stepfray | 5,104 Kb |
Content Changer | Cliffpyles | 4,538 Kb |
Mapbox Directions with geolocation tracking | Pollardld | 5,827 Kb |
CSS Donut Charts | Seanstopnik | 2,908 Kb |
A Pen by tugce | Ecgutcnkr | 4,197 Kb |
Angular-HAML | Cwacht | 2,022 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!