-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbutton.html
64 lines (58 loc) · 1.56 KB
/
button.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
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;
}
}
</style>
</head>
<body>
<div class="button">
<p>Click me</p>
</div>
<script>
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>
</body>
</html>