feat: finshi demo

This commit is contained in:
sangge 2023-10-29 13:44:30 +08:00
parent 52473f1bfe
commit 18fc2e6942
4 changed files with 41 additions and 7 deletions

View File

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 204 KiB

View File

@ -10,8 +10,10 @@
<body> <body>
<div class="canteen"> <div class="canteen">
<img src="background.png" class="background" alt="Background"> <img src="background.png" class="background" alt="Background">
<img src="rice_bucket.png" class="rice_bucket" alt="Rice bucket">
<img src="desktop.png" class="table" alt="Table"> <img src="desktop.png" class="table" alt="Table">
<img src="dinner_plate.png" class="plate" alt="Plate"> <img src="dinner_plate.png" class="plate" alt="Plate">
<img src="chef.png" class="chef" alt="Chef">
<img src="chef_hand.png" class="chef-hand" alt="Chef's Hand"> <img src="chef_hand.png" class="chef-hand" alt="Chef's Hand">
<img src="rice.png" class="rice" alt="Rice"> <img src="rice.png" class="rice" alt="Rice">
<img src="braised_pork.png" class="meat" alt="Meat"> <img src="braised_pork.png" class="meat" alt="Meat">

View File

@ -1,6 +1,7 @@
let step = 0; let step = 0;
function serveFood() { function serveFood() {
console.log("click")
switch(step) { switch(step) {
case 0: case 0:
document.querySelector('.chef-hand').style.opacity = '1'; document.querySelector('.chef-hand').style.opacity = '1';

View File

@ -1,16 +1,29 @@
.canteen { .background {
position: relative; position: relative;
width: 500px; width: 100%;
height: 500px; z-index: 0;
margin: 50px auto;
} }
.canteen {
width: 40vw; /* 设置为视口宽度 */
height: 40vw; /* 保持宽高比 */
position: relative;
}
.canteen img {
position: absolute;
width: 100%;
height: 100%;
}
.table { .table {
width: 100%; width: 100%;
height: 100%; height: 100%;
position: absolute; position: absolute;
top: 0; top: 0;
left: 0; left: 0;
z-index: 2;
} }
.plate { .plate {
@ -18,7 +31,7 @@
top: 50%; top: 50%;
left: 50%; left: 50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
z-index: 1; z-index: 3;
} }
.chef-hand { .chef-hand {
@ -38,7 +51,15 @@
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
opacity: 0; opacity: 0;
transition: opacity 0.5s; transition: opacity 0.5s;
z-index: 2; z-index: 3;
}
.chef {
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
z-index: 1;
} }
button { button {
@ -46,4 +67,14 @@ button {
margin: 20px auto; margin: 20px auto;
padding: 10px 20px; padding: 10px 20px;
font-size: 18px; font-size: 18px;
position: relative;
z-index: 10;
}
.rice_bucket{
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
z-index: 1;
} }