Snap: Chomping hamburger

Developer
Size
2,137 Kb
Views
16,192

How do I make an snap: chomping hamburger?

Simple snap animation on click. What is a snap: chomping hamburger? How do you make a snap: chomping hamburger? This script and codes were developed by Amanda Cheung on 15 November 2022, Tuesday.

Snap: Chomping hamburger Previews

Snap: Chomping hamburger - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Snap: Chomping hamburger</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="animation" class="animation"></div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='http://cdnjs.cloudflare.com/ajax/libs/snap.svg/0.3.0/snap.svg-min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Snap: Chomping hamburger - Script Codes CSS Codes

.animation { margin-right: auto; margin-left: auto; width: 342px; -webkit-transform: scale(.75,.75); transform: scale(.75,.75);
}

Snap: Chomping hamburger - Script Codes JS Codes

window.onload = function() { var animation = Snap.selectAll('.animation'); Snap.load("https://dl.dropboxusercontent.com/u/38675407/the-whole-burger.svg", function (s) { var whole = s.select('#whole'), top = whole.select('#top-bun'), lettuce = whole.select('#lettuce'), tomato = whole.select('#tomato'), cheese = whole.select('#cheese'), burger = whole.select('#burger'), bottom = whole.select('#bottom-bun'), animating = false; function reset() { whole.transform("t0,0"); } function expand(delay, length) { animating = true; top.animate({ transform: "t0,-100" }, length, mina.easeinout); lettuce.animate({ transform: "t0,-60" }, length, mina.easeinout); tomato.animate({ transform: "t0,-20" }, length, mina.easeinout); cheese.animate({ transform: "t0,20" }, length, mina.easeinout); burger.animate({ transform: "t0,60" }, length, mina.easeinout); bottom.animate({ transform: "t0,100" }, length, mina.easeinout); } function chomp(delay, length) { setTimeout(function(){ top.animate({ transform: "t0,0" }, length, mina.easeout); lettuce.animate({ transform: "t0,0" }, length, mina.easeout); tomato.animate({ transform: "t0,0" }, length, mina.easeout); cheese.animate({ transform: "t0,0" }, length, mina.easeout); burger.animate({ transform: "t0,0" }, length, mina.easeout); bottom.animate({ transform: "t0,0" }, length, mina.easeout); }, delay); } function burger_chomp() { expand(0, 900); chomp(1000, 80); } reset() animation.forEach(function(el) { el.append(s); }); whole.click(function() { reset(); burger_chomp(); }); });
}
Snap: Chomping hamburger - Script Codes
Snap: Chomping hamburger - Script Codes
Home Page Home
Developer Amanda Cheung
Username acacheung
Uploaded November 15, 2022
Rating 3
Size 2,137 Kb
Views 16,192
Do you need developer help for Snap: Chomping hamburger?

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!

Amanda Cheung (acacheung) Script Codes
Create amazing marketing copy 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!