-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton effects.html
More file actions
113 lines (97 loc) · 2.86 KB
/
Copy pathbutton effects.html
File metadata and controls
113 lines (97 loc) · 2.86 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Button Animations</title>
<style>
.container {
padding: 20px;
}
.radio-group {
margin-bottom: 20px;
}
.radio-group label {
display: block;
margin: 10px 0;
}
/* Base button styles */
.animated-button {
position: relative;
height: 70px;
width: 150px;
background: transparent;
border: 2px solid violet;
color: violet;
cursor: pointer;
overflow: hidden;
z-index: 1;
}
.animated-button::before {
content: '';
position: absolute;
background: violet;
height: 100%;
width: 100%;
top: 0;
left: 0;
z-index: -1;
transition: clip-path 0.7s ease-in-out;
}
.animated-button:hover {
color: white;
}
/* Animation variations */
.circle::before {
clip-path: circle(0% at 0% 100%);
}
.circle:hover::before {
clip-path: circle(150% at 0% 100%);
}
.ellipse::before {
clip-path: ellipse(0% 0% at 0% 100%);
}
.ellipse:hover::before {
clip-path: ellipse(150% 150% at 0% 100%);
}
.polygon::before {
clip-path: polygon(0% 100%, 0% 100%, 0% 100%);
}
.polygon:hover::before {
clip-path: polygon(-50% 150%, 150% -50%, 150% 150%);
}
</style>
</head>
<body>
<div class="container">
<div class="radio-group">
<h2>Select Animation Style:</h2>
<label>
<input type="radio" name="effect" value="circle" checked>
Circular Reveal
</label>
<label>
<input type="radio" name="effect" value="ellipse">
Elliptical Reveal
</label>
<label>
<input type="radio" name="effect" value="polygon">
Diagonal Sweep
</label>
</div>
<button class="animated-button circle">Hover on me!</button>
</div>
<script>
const button = document.querySelector('.animated-button');
const radioButtons = document.querySelectorAll('input[name="effect"]');
radioButtons.forEach(radio => {
radio.addEventListener('change', (e) => {
// Remove all animation classes
button.classList.remove('circle', 'ellipse', 'polygon');
// Add the selected animation class
button.classList.add(e.target.value);
});
});
</script>
</body>
</html>