Currently the transition for when the wall closes and opens is exactly the same.
Is there a way to set 2 different transitions, one for when the wall goes down, and one for when the wall goes up?
Is there a way for this to be improved?
code https://jsfiddle.net/0sfng5ow/
.video-one {
top: -101%;
/* for testing: fast */
transition: all 10s ease-in 0s;
transition-delay: 1s;
}
.video-one.closed {
top: 0%;
}
let videoOne = document.querySelector('.video-one')
requestAnimationFrame(() => {
// should be a frame while it's not closed for transition to work
videoOne.classList.toggle('closed', true)
})
function coverClickHandler(evt) {
const cover = evt.currentTarget;
const curtain = openCurtain(cover);
videoOne.classList.toggle('closed', false)
showVideo(curtain);
cover.dispatchEvent(new Event("afterClick"));
}
How the code works is, on page load the wall comes down, then on button click the wall goes up.
My Improved Version: https://jsfiddle.net/6g25h9au/3/
This allows me to set 2 different transitions.
.video-one {
top: -101%;
/* for testing: fast */
transition: all 10s ease-in 0s;
transition-delay: 1s;
}
.video-one.slide {
top: 0%;
}
.curtain.slide .video-one {
transition-delay: 3s;
transform: translateY(calc(-100% - 1px));
}
let videoOne = document.querySelector('.video-one')
requestAnimationFrame(() => {
// should be a frame while it's not closed for transition to work
videoOne.classList.add("slide");
})
.video-one {
position: absolute;
height: 100%;
width: 100%;
top: 0;
background: repeating-linear-gradient( calc(var(--angle1) * 1deg), #ffffff00 0, #ffffff00 var(--wide), #ffffff1a calc(var(--wide) + 1px), #0000004d calc(var(--wide) + 2px), #ffffff00 calc(var(--wide) + 5px)), repeating-linear-gradient( calc(calc(var(--angle2) + 90) * 1deg), #ffffff00 0, #ffffff00 var(--wide), #ffffff1a calc(var(--wide) + 1px), #0000004d calc(var(--wide) + 2px), #ffffff00 calc(var(--wide) + 5px));
background-color: #222;
border-bottom: 2px solid red;
background-repeat: no-repeat;
z-index: 0;
}
.video-one::after {
content: "";
position: absolute;
left: 0;
right: 0;
bottom: 0;
top: 0;
background: url("https://via.placeholder.com/264x264");
background-position: center;
background-size: 41.25% 73.33%;
background-repeat: no-repeat;
}