Skip to content

Instantly share code, notes, and snippets.

@diveyez
Created October 28, 2018 10:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diveyez/bb9963768168781af3ce2e21bd68aea9 to your computer and use it in GitHub Desktop.
Save diveyez/bb9963768168781af3ce2e21bd68aea9 to your computer and use it in GitHub Desktop.
Jelly button
<link rel="stylesheet" href="//brick.a.ssl.fastly.net/Roboto:400"/>
<div class="button">
<p>Click me</p>
</div>
var $button = document.querySelector('.button');
$button.addEventListener('click', function() {
var duration = 0.3,
delay = 0.08;
TweenMax.to($button, duration, {scaleY: 1.6, ease: Expo.easeOut});
TweenMax.to($button, duration, {scaleX: 1.2, scaleY: 1, ease: Back.easeOut, easeParams: [3], delay: delay});
TweenMax.to($button, duration * 1.25, {scaleX: 1, scaleY: 1, ease: Back.easeOut, easeParams: [6], delay: delay * 3 });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.12.1/TweenMax.min.js"></script>
body {
background: #f1c40f;
}
.button {
background: #3498db;
width: 180px;
padding: 4px 0;
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
border-radius: 3px;
p {
font-family: 'Roboto';
text-align: center;
text-transform: uppercase;
color: #FFF;
user-select: none;
}
&:hover {
cursor: pointer;
}
&:after {
content: "";
display: block;
position: absolute;
width: 100%;
height: 10%;
border-radius: 50%;
background-color: darken(#f1c40f, 20%);
opacity: 0.4;
bottom: -30px;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment