feat: update mirror rice and pork

This commit is contained in:
sangge 2023-10-29 14:09:09 +08:00
parent 18fc2e6942
commit 323b0df7b4
3 changed files with 33 additions and 1 deletions

View File

@ -17,6 +17,8 @@
<img src="chef_hand.png" class="chef-hand" alt="Chef's Hand">
<img src="rice.png" class="rice" alt="Rice">
<img src="braised_pork.png" class="meat" alt="Meat">
<img src="rice.png" class="rice-mirror" alt="Rice mirror">
<img src="braised_pork.png" class="meat-mirror" alt="Meat mirror">
</div>
<button onclick="serveFood()">Serve Food</button>

View File

@ -1,7 +1,6 @@
let step = 0;
function serveFood() {
console.log("click")
switch(step) {
case 0:
document.querySelector('.chef-hand').style.opacity = '1';
@ -17,9 +16,30 @@ function serveFood() {
document.querySelector('.chef-hand').style.opacity = '0';
}, 500);
break;
case 2:
document.querySelector('.chef-hand').style.opacity = '1';
setTimeout(() => {
document.querySelector('.rice-mirror').style.opacity = '1';
document.querySelector('.chef-hand').style.opacity = '0';
}, 500);
break;
case 3:
document.querySelector('.chef-hand').style.opacity = '1';
setTimeout(() => {
document.querySelector('.meat-mirror').style.opacity = '1';
document.querySelector('.chef-hand').style.opacity = '0';
}, 500);
break;
case 4:
document.querySelector('.rice').style.opacity = '0';
document.querySelector('.meat').style.opacity = '0';
document.querySelector('.rice-mirror').style.opacity = '0';
document.querySelector('.meat-mirror').style.opacity = '0';
step = -1;
default:
step = -1;
break;
}
step++;
console.log(step);
}

View File

@ -54,6 +54,16 @@
z-index: 3;
}
.rice-mirror, .meat-mirror {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scaleX(-1);
opacity: 0;
transition: opacity 0.5s;
z-index: 3;
}
.chef {
position: absolute;
bottom: 0;