Skip to content

Commit

Permalink
smoother curtain
Browse files Browse the repository at this point in the history
  • Loading branch information
CHooverShrimp committed Nov 9, 2024
1 parent 60b7fa1 commit 3381b56
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
13 changes: 8 additions & 5 deletions public/js/curtain.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@ document.addEventListener('DOMContentLoaded', function() {
});

document.getElementById('enter-button').addEventListener('click', function() {
// Setting the panel to go down
fallingImage.style.top = '0px'; // Set final position

const elementLeft = document.querySelector('.curtain-left');
const elementRight = document.querySelector('.curtain-right');

elementLeft.classList.add('animate-curtain-left');
elementRight.classList.add('animate-curtain-right');

// Hiding the button
this.classList.add('fade-out');

// Move curtains
document.querySelector('.curtain-left').style.transform = 'translateX(-100%)';
document.querySelector('.curtain-right').style.transform = 'translateX(100%)';

setTimeout(() => {
this.style.display = 'none';
}, 500)
Expand Down
34 changes: 33 additions & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ import { Image } from 'astro:assets';
position: relative;
top: 0;
height: 100%;
transition: transform 2s ease-in-out;
transition: transform 2.2s ease-in-out;
box-shadow: 0px 0px 100px rgba(0, 0, 0, 0.5);
}

Expand All @@ -384,6 +384,38 @@ import { Image } from 'astro:assets';
transform: translateX(-20px);
}

.animate-curtain-left
{
animation: curtain-left 2.2s ease-in-out;
}

.animate-curtain-right
{
animation: curtain-right 2.2s ease-in-out;
}

@keyframes curtain-left {
0% {
}
15% {
transform: translateX(40px);
}
to {
transform:translateX(-150%);
}
}

@keyframes curtain-right {
0% {
}
15% {
transform: translateX(-40px);
}
to {
transform:translateX(150%);
}
}

.falling-image {
position: absolute;
top: -400px;
Expand Down

0 comments on commit 3381b56

Please sign in to comment.