mirror of
https://github.com/RetroDECK/RetroDECK-Website.git
synced 2024-11-23 23:25:39 +00:00
Change animation to fade/slide
This commit is contained in:
parent
459ae4a604
commit
f056f86803
|
@ -10,12 +10,13 @@
|
||||||
|
|
||||||
.screenshot {
|
.screenshot {
|
||||||
position: relative;
|
position: relative;
|
||||||
/* animation: lower 100ms forwards; */
|
/* transition: bottom 400ms; */
|
||||||
}
|
}
|
||||||
|
|
||||||
.screenshot:nth-child(3) {
|
.screenshot:nth-child(3) {
|
||||||
z-index: 4;
|
z-index: 4;
|
||||||
left: -200%;
|
left: -200%;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.screenshot:nth-child(2) {
|
.screenshot:nth-child(2) {
|
||||||
|
@ -29,7 +30,7 @@
|
||||||
bottom: 20px;
|
bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes lower {
|
/* @keyframes lower {
|
||||||
from {
|
from {
|
||||||
animation-timing-function: ease-in-out;
|
animation-timing-function: ease-in-out;
|
||||||
}
|
}
|
||||||
|
@ -50,4 +51,30 @@
|
||||||
transform: translate(30px, -30px) rotate(0deg);
|
transform: translate(30px, -30px) rotate(0deg);
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
}
|
}
|
||||||
|
} */
|
||||||
|
|
||||||
|
@keyframes fade-out {
|
||||||
|
0% {
|
||||||
|
/* z-index: 3; */
|
||||||
|
bottom: 0;
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
/* z-index: 0; */
|
||||||
|
opacity: 0;
|
||||||
|
bottom: -30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fade-in {
|
||||||
|
0% {
|
||||||
|
/* z-index: 3; */
|
||||||
|
bottom: 0;
|
||||||
|
opacity: 10px;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
/* z-index: 0; */
|
||||||
|
opacity: 1;
|
||||||
|
bottom: 20px;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,6 @@
|
||||||
let timing = 2000;
|
let timing = 400;
|
||||||
|
|
||||||
// let stack = document.querySelector(".stack");
|
|
||||||
let stacks = document.getElementsByClassName('stack');
|
let stacks = document.getElementsByClassName('stack');
|
||||||
|
|
||||||
// [...stack.children].reverse().forEach(i => stack.append(i));
|
|
||||||
for (let i = 0; i < stacks.length; i++) {
|
for (let i = 0; i < stacks.length; i++) {
|
||||||
[...stacks[i].children].reverse().forEach(j => stacks[i].append(j));
|
[...stacks[i].children].reverse().forEach(j => stacks[i].append(j));
|
||||||
stacks[i].addEventListener("click", swap);
|
stacks[i].addEventListener("click", swap);
|
||||||
|
@ -12,10 +9,16 @@ for (let i = 0; i < stacks.length; i++) {
|
||||||
function swap(e) {
|
function swap(e) {
|
||||||
let thisTarget = e.target
|
let thisTarget = e.target
|
||||||
if (!thisTarget.classList.contains('screenshot')) return;
|
if (!thisTarget.classList.contains('screenshot')) return;
|
||||||
thisTarget.style.animation = `swap ${timing}ms ease-in-out forwards`;
|
thisTarget.style.animation = `fade-out ${timing}ms ease-in forwards`;
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
thisTarget.style.animation = "";
|
thisTarget.style.animation = `fade-in ${timing}ms ease-out forwards`;
|
||||||
this.prepend(thisTarget);
|
this.prepend(thisTarget);
|
||||||
|
// thisTarget.style = '';
|
||||||
|
|
||||||
}, timing);
|
}, timing);
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
thisTarget.style = '';
|
||||||
|
}, 2*timing);
|
||||||
}
|
}
|
Loading…
Reference in a new issue