Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions kinetic-loader/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
</head>
<body>
<div class="kinetic"></div>


<button id="toggle-btn">Toggle Direction</button>

<script src="script.js"></script>
</body>
</html>
</html>
7 changes: 7 additions & 0 deletions kinetic-loader/script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const kineticLoader = document.querySelector('.kinetic');
const toggleBtn = document.getElementById('toggle-btn');

toggleBtn.addEventListener('click', () => {
// Adds the 'reverse' class if it's not there, removes it if it is
kineticLoader.classList.toggle('reverse');
});
33 changes: 31 additions & 2 deletions kinetic-loader/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,24 @@ body {
height: 0;
border: 50px solid transparent;
border-bottom-color: #fff;
animation: rotateA 2s linear infinite 0.5s;
/* Ensure animation direction is normal by default */
animation: rotateA 2s linear infinite 0.5s normal;
}

.kinetic::before {
transform: rotate(90deg);
animation: rotateB 2s linear infinite;
/* Ensure animation direction is normal by default */
animation: rotateB 2s linear infinite normal;
}

/* --- ADDED: Reverse animation class --- */
.kinetic.reverse::before,
.kinetic.reverse::after {
animation-direction: reverse;
}
/* --- End Added --- */


@keyframes rotateA {
0%,
25% {
Expand Down Expand Up @@ -67,3 +77,22 @@ body {
transform: rotate(450deg);
}
}

/* --- ADDED: Button styles --- */
button {
position: absolute;
bottom: 30px;
left: 50%;
transform: translateX(-50%);
padding: 10px 20px;
background-color: #fff;
border: 1px solid #333;
border-radius: 5px;
cursor: pointer;
font-family: inherit; /* Use same font as body */
}

button:hover {
background-color: #eee; /* Slight hover effect */
}
/* --- End Added --- */