Skip to content

Commit

Permalink
completed form wave animation
Browse files Browse the repository at this point in the history
  • Loading branch information
tsr-kairi committed Jun 30, 2021
1 parent ebe7716 commit fe31137
Show file tree
Hide file tree
Showing 3 changed files with 164 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Day 8 - Form Wave Animation/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Block Elements and Variables
const labels = document.querySelectorAll(".form-control label");

// forEach
labels.forEach((label) => {
label.innerHTML = label.innerText
.split("")
.map(
(letter, idx) =>
`<span style="transition-delay:${idx * 50}ms">${letter}</span>`
)
.join("");
});
49 changes: 49 additions & 0 deletions Day 8 - Form Wave Animation/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="./style.css" />
<title>From | Input | Wave</title>
</head>
<body>
<div class="container">
<h1>Please Login</h1>
<form>
<div class="form-control">
<input type="email" required />
<label>Email</label>
<!-- <label>
<span style="transition-delay: 0ms">E</span>
<span style="transition-delay: 50ms">m</span>
<span style="transition-delay: 100ms">a</span>
<span style="transition-delay: 150ms">i</span>
<span style="transition-delay: 200ms">l</span>
</label> -->
</div>

<div class="form-control">
<input type="password" required />
<label>Password</label>
<!-- <label>
<span style="transition-delay: 0ms">P</span>
<span style="transition-delay: 25ms">a</span>
<span style="transition-delay: 50ms">s</span>
<span style="transition-delay: 75ms">s</span>
<span style="transition-delay: 100ms">w</span>
<span style="transition-delay: 150ms">0</span>
<span style="transition-delay: 175ms">r</span>
<span style="transition-delay: 200ms">d</span>
</label> -->
</div>

<button class="btn">Login</button>

<p class="text">Do't have an account? <a href="#">Register</a></p>
</form>
</div>

<script src="./app.js"></script>
</body>
</html>
102 changes: 102 additions & 0 deletions Day 8 - Form Wave Animation/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
@import url("https://fonts.googleapis.com/css2?family=Muli&family=Pattaya&display=swap");

*::after,
*::before {
box-sizing: border-box;
margin: 0;
padding: 0;
}

body {
background-color: steelblue;
color: #fff;
font-family: "Muli", sans-serif;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
overflow: hidden;
margin: 0;
}

.container {
background-color: rgba(0, 0, 0, 0.4);
padding: 20px 40px;
border-radius: 5px;
}

.container h1 {
text-align: center;
margin-bottom: 30px;
}

.container a {
text-decoration: none;
color: lightblue;
}

.btn {
cursor: pointer;
display: inline-block;
width: 100%;
background: lightblue;
padding: 15px;
font-size: 16px;
border: 0;
border-radius: 5px;
}

.btn:focus {
outline: 0;
}

.btn:active {
transform: scale(0.98);
}

.text {
margin-top: 30px;
}

.form-control {
position: relative;
margin: 20px 0 40px;
width: 300px;
}

.form-control input {
background-color: transparent;
border: 0;
border-bottom: 2px solid #fff;
display: block;
width: 100%;
padding: 15px 0;
font-size: 18px;
color: #fff;
}

.form-control input:focus,
form-control input:valid {
outline: 0;
border-bottom-color: lightblue;
}

.form-control label {
position: absolute;
top: 15px;
left: 0;
}

.form-control label span {
display: inline-block;
font-size: 18px;
min-width: 5px;
transition: 0.3s cubic-bezier(0.68, -0.55, 0.256, 1.55);
}

.form-control input:focus + label span,
.form-control input:valid + label span {
color: lightblue;
transform: translateY(-30px);
}

0 comments on commit fe31137

Please sign in to comment.