Skip to content

Commit c8663dd

Browse files
Merge pull request #42 from akashnai/akkicode
form wave animation
2 parents 84097b7 + b8d5ee9 commit c8663dd

6 files changed

Lines changed: 224 additions & 0 deletions

File tree

form wave animation/index.html

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
8+
<link rel="stylesheet" href="style.css">
9+
<title>Form Input wave</title>
10+
</head>
11+
<body>
12+
<div class="container">
13+
<h1>Please Login</h1>
14+
<form>
15+
<div class="form-control">
16+
<input type="text" required>
17+
<label>Email</label>
18+
</div>
19+
<div class="form-control">
20+
<input type="password" required>
21+
<label>Password</label>
22+
</div>
23+
24+
<button class="btn">Login</button>
25+
26+
<p class="text">Don't have an account? <a href="#">Register</a></p>
27+
</form>
28+
</div>
29+
<script src="script.js"></script>
30+
</body>
31+
</html>

form wave animation/script.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const labels = document.querySelectorAll('.form-control label')
2+
labels.forEach(label => {
3+
label.innerHTML = label.innerText
4+
.split('')
5+
.map((letter, idx) => `<span style="transition-delay:${idx * 50}ms">${letter}</span>`)
6+
.join('')
7+
})

form wave animation/style.css

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
@import url('https://fonts.googleapis.com/css?family=Muli&display=swap');
2+
3+
*{
4+
box-sizing: border-box;
5+
}
6+
7+
body{
8+
background-color: steelblue;
9+
color: #fff;
10+
font-family: 'Muli', sans-serif;
11+
margin: 0;
12+
display: flex;
13+
flex-direction: column;
14+
align-items: center;
15+
justify-content: center;
16+
height: 100vh;
17+
overflow: hidden;
18+
}
19+
20+
21+
.container{
22+
background-color: rgba(0,0,0,0.4);
23+
padding: 20px 40px;
24+
border-radius: 5px;
25+
}
26+
27+
.container h1{
28+
text-align: center;
29+
margin-bottom: 30px;
30+
}
31+
32+
.container a{
33+
text-decoration: none;
34+
color: lightblue;
35+
}
36+
37+
.btn{
38+
cursor: pointer;
39+
display: inline-block;
40+
width: 100%;
41+
background: lightblue;
42+
padding: 15px;
43+
font-family: inherit;
44+
border: 0;
45+
border-radius: 5px;
46+
}
47+
48+
.btn:focus{
49+
outline: 0;
50+
}
51+
52+
.btn:active{
53+
transform: scale(0.98);
54+
}
55+
56+
.text{
57+
margin-top: 30px;
58+
}
59+
60+
.form-control{
61+
position: relative;
62+
margin: 20px 0 40px;
63+
width: 300px;
64+
}
65+
66+
.form-control input{
67+
background-color: transparent;
68+
border: 0;
69+
border-bottom: 2px #fff solid;
70+
display: block;
71+
width: 100%;
72+
padding: 15px 0;
73+
font-size: 18px;
74+
color: white;
75+
}
76+
77+
.form-control input:focus, .form-control input:valid{
78+
outline: 0;
79+
border-bottom-color: lightblue;
80+
}
81+
82+
.form-control label{
83+
position: absolute;
84+
top: 15px;
85+
left: 0;
86+
}
87+
88+
.form-control label span{
89+
display: inline-block;
90+
font-size: 18px;
91+
min-width: 5px;
92+
transition: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
93+
}
94+
95+
.form-control input:focus + label span,
96+
.form-control input:valid + label span{
97+
color: lightblue;
98+
transform: translateY(-30px);
99+
}

hidden search widget/index.html

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.0/css/all.min.css" integrity="sha512-xh6O/CkQoPOWDdYTDqeRdPCVd1SpvCA9XXcUnZS2FmJNp1coAFzvtCN9BmamE+4aHK8yyUHUSCcJHgXloTyT2A==" crossorigin="anonymous" referrerpolicy="no-referrer" />
8+
<link rel="stylesheet" href="style.css">
9+
<title>My Project</title>
10+
</head>
11+
<body>
12+
<div class="search">
13+
<input type="text" placeholder="Search..." class="input">
14+
<button class="btn">
15+
<i class="fas fa-search"></i>
16+
</button>
17+
</div>
18+
<script src="script.js"></script>
19+
</body>
20+
</html>

hidden search widget/script.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const search = document.querySelector('.search')
2+
const btn = document.querySelector('.btn')
3+
const input = document.querySelector('.input')
4+
5+
btn.addEventListener('click', () => {
6+
search.classList.toggle('active')
7+
input.focus()
8+
})

hidden search widget/style.css

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap');
2+
3+
*{
4+
box-sizing: border-box;
5+
}
6+
7+
body{
8+
background-image: linear-gradient(90deg, #7d5fff, #7158e2);
9+
font-family: 'Roboto', sans-serif;
10+
margin: 0;
11+
display: flex;
12+
align-items: center;
13+
justify-content: center;
14+
height: 100vh;
15+
overflow: hidden;
16+
}
17+
18+
19+
.search {
20+
position: relative;
21+
height: 50px;
22+
}
23+
24+
.search .input{
25+
background-color: #fff;
26+
border: 0;
27+
font-size: 18px;
28+
padding: 15px;
29+
height: 50px;
30+
width: 50px;
31+
transition: width 0.3s ease;
32+
}
33+
34+
.btn{
35+
background-color: #fff;
36+
border: 0;
37+
cursor: pointer;
38+
font-size: 24px;
39+
position: absolute;
40+
top: 0;
41+
left: 0;
42+
height: 50px;
43+
width: 50px;
44+
transition: transform 0.3s ease;
45+
46+
}
47+
48+
.btn:focus, .input:focus{
49+
outline: none;
50+
51+
}
52+
53+
.search.active .input{
54+
width: 200px;
55+
}
56+
57+
.search.search.active .btn {
58+
transform: translateX(198px);
59+
}

0 commit comments

Comments
 (0)