Skip to content

Commit 5af8928

Browse files
committed
some details
1 parent 4d43b57 commit 5af8928

File tree

5 files changed

+40
-66
lines changed

5 files changed

+40
-66
lines changed

src/app.css

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -38,51 +38,6 @@ body {
3838
}
3939
}
4040

41-
42-
.loading-container {
43-
position: relative;
44-
width: 90%;
45-
max-width: 600px;
46-
height: 8px;
47-
border-radius: 6px;
48-
}
49-
50-
#loading-bar {
51-
width: 0%;
52-
height: 100%;
53-
background-color: #ffe65a;
54-
transition: width 0.2s ease;
55-
height: 100%;
56-
border-radius: 4px;
57-
position: relative;
58-
}
59-
60-
#loading-bar::after {
61-
content: "";
62-
position: absolute;
63-
top: -65px;
64-
right: -15px;
65-
width: 60px;
66-
height: 60px;
67-
background: url("/imgs/meidi.png") no-repeat center / contain;
68-
}
69-
70-
#loading-overlay {
71-
position: fixed;
72-
top: 0;
73-
left: 0;
74-
width: 100%;
75-
height: 100%;
76-
background-color: #2a4d33;
77-
display: flex;
78-
justify-content: center;
79-
align-items: center;
80-
z-index: 999;
81-
transition: opacity 0.1s ease-out;
82-
}
83-
84-
85-
8641
@keyframes dog-jump {
8742
0% { transform: translateY(0); }
8843
30% { transform: translateY(-20px); }
@@ -91,6 +46,6 @@ body {
9146
100% { transform: translateY(0); }
9247
}
9348

94-
#loading-bar.done::after {
49+
#loading-bar>.done {
9550
animation: dog-jump 0.6s ease-out;
9651
}

src/components/Footer.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
{#if visible}
99
<div
10-
class="fixed bottom-1 px-2 md:px-5 w-full flex font-serif items-center justify-between text-white/50"
10+
class="fixed bottom-1 px-2 md:px-5 w-full flex font-serif items-center justify-between text-white/50 z-[11]"
1111
transition:fade={{duration: 200}}
1212
>
1313
<div class="flex items-center text-sm gap-1 md:gap-2">
@@ -19,7 +19,7 @@
1919
>
2020
</div>
2121

22-
<div class="text-xs text-center whitespace-pre-line hidden md:block max-w-md mb-[2px]">
22+
<div class="text-[0.65rem] leading-3 text-center whitespace-pre-line hidden md:block max-w-md mb-[2px]">
2323
If you are a ( former ) Douban employee and would like your pet
2424
to be featured on the site, please reach out to <a
2525
href="mailto:[email protected]">Yanxin</a
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
<div id="loading-overlay">
2-
<div class="loading-container">
3-
<div id="loading-bar"></div>
1+
<div
2+
id="loading-overlay"
3+
class="fixed inset-0 bg-[#3b8f51] flex justify-center items-center z-10 transition-opacity duration-100 ease-out"
4+
>
5+
<div class="relative w-[90%] max-w-[600px] h-2 rounded-[6px]">
6+
<div
7+
id="loading-bar"
8+
class="relative h-full w-0 bg-[#ffe65a] transition-[width] duration-200 ease-in-out rounded-[4px]"
9+
>
10+
<img
11+
src="/imgs/meidi.png"
12+
class="absolute -top-14 -right-3 md:-top-18 md:-right-5 w-12 h-12 md:w-15 md:h-15"
13+
/>
14+
</div>
415
</div>
516
</div>

src/components/VideoOverlay.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
</button>
2323

2424
<video
25-
class="w-[80%] lg:w-[60%] mt-2 h-auto block mx-auto rounded-xl"
25+
class="w-[80%] md:w-[60%] mt-2 h-auto block mx-auto rounded-xl max-h-[90vh]"
2626
playsinline
2727
loop
2828
autoplay

src/lib/BookScene.ts

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class BookScene {
4646
private raycaster: THREE.Raycaster = new THREE.Raycaster();
4747
private mouse: THREE.Vector2 = new THREE.Vector2();
4848
private isFluttering: boolean = false;
49+
private isHoveringCover = false;
4950

5051
constructor (container: HTMLDivElement) {
5152
this.container = container;
@@ -77,10 +78,10 @@ export class BookScene {
7778
this.renderer.setClearColor(palette.bg[0]);
7879
this.container.appendChild(this.renderer.domElement);
7980

80-
this.setUpLight();
81+
this.setupLight();
8182
// this.setupLightControls();
8283
this.setupLoadingManager();
83-
this.setUpPositionAndRotation();
84+
this.setupPositionAndRotation();
8485
this.setupHoverInteraction();
8586

8687
window.addEventListener('resize', () => this.handleResize());
@@ -94,6 +95,7 @@ export class BookScene {
9495
private setupLoadingManager() {
9596
const loadingOverlay = document.getElementById('loading-overlay');
9697
const loadingBar = document.getElementById('loading-bar');
98+
const dog = loadingBar.firstChild;
9799

98100
if (!loadingOverlay || !loadingBar) {
99101
console.error('Loading screen elements not found in the DOM.');
@@ -106,7 +108,7 @@ export class BookScene {
106108
};
107109

108110
this.loadingManager.onLoad = () => {
109-
(loadingBar as HTMLElement).classList.add("done");
111+
(dog as HTMLElement).classList.add("done");
110112

111113
setTimeout(() => {
112114
this.renderable = true;
@@ -123,7 +125,7 @@ export class BookScene {
123125
};
124126
}
125127

126-
private setUpLight() {
128+
private setupLight() {
127129
this.scene.add(this.ambientLight);
128130

129131
const rLight = new THREE.DirectionalLight(0xffffff, 0.6);
@@ -163,6 +165,7 @@ export class BookScene {
163165
this.renderer.domElement.addEventListener('mousemove', this._onMouseMove.bind(this), false);
164166
}
165167

168+
166169
private _onMouseMove(event: MouseEvent) {
167170
if (this.openingAnimationStatus !== 'none' || this.isFluttering || this.isMobile) {
168171
return;
@@ -178,7 +181,12 @@ export class BookScene {
178181
const intersects = this.raycaster.intersectObject(cover, true);
179182

180183
if (intersects.length > 0) {
181-
this._playFlutterAnimation();
184+
if (!this.isHoveringCover) {
185+
this._playFlutterAnimation();
186+
this.isHoveringCover = true;
187+
}
188+
} else {
189+
this.isHoveringCover = false;
182190
}
183191
}
184192

@@ -207,7 +215,7 @@ export class BookScene {
207215
}
208216

209217

210-
private setUpPositionAndRotation() {
218+
private setupPositionAndRotation() {
211219
this.camera.position.add(this.initialCameraOffset);
212220
this.camera.up.copy(this.initialCameraUp);
213221

@@ -514,8 +522,8 @@ export class BookScene {
514522
zooGroup.position.set(config.pageWidth, 0.2, config.pageHeight * 0.8);
515523
zooGroup.rotation.y = -Math.PI / 2;
516524
} else {
517-
zooGroup.position.set(config.pageWidth * 0.5, 0, 0);
518-
zooGroup.rotation.y = -Math.PI / 12;
525+
zooGroup.position.set(config.pageWidth * 0.6, 0, 0);
526+
zooGroup.rotation.y = -Math.PI / 6;
519527
}
520528
this.homeGroup.add(zooGroup);
521529

@@ -553,7 +561,7 @@ export class BookScene {
553561
doubanGroup.position.set(config.pageWidth / 2, 0, 0);
554562
doubanGroup.rotation.x = -Math.PI / 16;
555563
} else {
556-
doubanGroup.position.set(-config.pageWidth / 3, 0, 0);
564+
doubanGroup.position.set(-config.pageWidth / 4, 0, 0);
557565
doubanGroup.rotation.y = Math.PI / 16;
558566
}
559567
this.homeGroup.add(doubanGroup);
@@ -564,7 +572,7 @@ export class BookScene {
564572

565573
this.book.add(this.homeGroup);
566574

567-
const dropHeight = 10;
575+
const dropHeight = 6;
568576
const textTargetY = (boxGeo: THREE.BoxGeometry) => boxGeo.parameters.height / 2 + 0.4;
569577

570578
// Initial positions
@@ -574,14 +582,14 @@ export class BookScene {
574582
doubanText.position.y = dropHeight + textTargetY(doubanBoxGeo);
575583

576584
const tl = gsap.timeline({
577-
defaults: { duration: 1, ease: 'bounce.out' }
585+
defaults: { duration: 1.2, ease: 'bounce.out' }
578586
});
579587

580588
tl.to(zooBox.position, { y: 0 }, 0);
581-
tl.to(doubanBox.position, { y: 0 }, 0.3);
589+
tl.to(doubanBox.position, { y: 0 }, 0.2);
582590

583-
tl.to(zooText.position, { y: textTargetY(zooBoxGeo) }, 1.2);
584-
tl.to(doubanText.position, { y: textTargetY(doubanBoxGeo) }, 1.4);
591+
tl.to(zooText.position, { y: textTargetY(zooBoxGeo) }, 1);
592+
tl.to(doubanText.position, { y: textTargetY(doubanBoxGeo) }, 1.2);
585593
});
586594
}
587595
}

0 commit comments

Comments
 (0)