Skip to content

Commit b6bc318

Browse files
committed
update
1 parent ec6edac commit b6bc318

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

src/app.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@import "tailwindcss";
22

33
@theme {
4-
--font-sans: "Songti SC", "STSong", serif;
4+
--font-serif: "Songti SC", "STSong", serif;
55
}
66

77
body {
@@ -10,7 +10,7 @@ body {
1010
#photo-overlay-container {
1111
@apply absolute w-full h-full pointer-events-none overflow-hidden left-0 top-0;
1212
}
13-
13+
1414
.draggable-photo {
1515
--shadow-offset: 5px;
1616
--shadow-color: #eee;

src/components/WikiHeader.svelte

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,11 @@
2121
scroll();
2222
}
2323
24+
$: if (!currentPage) {
25+
visible = false;
26+
showModal = false;
27+
}
28+
2429
async function scroll() {
2530
if (!textEl) return;
2631
gsap.killTweensOf(textEl);
@@ -77,7 +82,7 @@
7782
>
7883
{@html Scroll}
7984
</button>
80-
<div class="relative overflow-hidden flex-1 h-full">
85+
<div class="relative overflow-hidden flex-1 h-full -ml-2 -mr-2">
8186
<div
8287
bind:this={textEl}
8388
class="absolute whitespace-nowrap text-sm lg:text-base will-change-transform top-0 left-12 h-full flex items-center"
@@ -100,13 +105,13 @@
100105
{/if}
101106
{#if showModal}
102107
<div
103-
class="fixed inset-0 bg-black/60 flex items-center justify-center z-50 backdrop-blur-lg"
108+
class="fixed inset-0 z-50 bg-black/60 flex items-center justify-center backdrop-blur-lg will-change-transform will-change-opacity"
104109
id="wiki-modal"
105-
transition:fade={{duration: 150}}
110+
transition:fade={{duration: 200}}
106111
>
107112
<div
108113
class="rounded-lg px-4 md:px-20 text-[var(--textColor)] text-center overflow-y-auto py-6 max-h-[90vh]"
109-
transition:fly={{y: 20, duration: 300}}
114+
transition:fly={{y: 20, duration: 200}}
110115
>
111116
<div class="space-y-4 text-2xl lg:text-4xl leading-9 md:leading-14 font-sans italic">
112117
{#each lines as line}

src/lib/BookScene.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ export class BookScene {
3737
private normalCameraZ: number = 6;
3838
private closedCameraZ: number = 4;
3939

40-
private initialCameraOffset = isDev() ? new THREE.Vector3(0, 0, 0) : new THREE.Vector3(5, -5, -4);
41-
private initialCameraUp = isDev() ? new THREE.Vector3(0, 1, 0) : new THREE.Vector3(-2, 3, 3);
40+
private initialCameraOffset = isDev() ? new THREE.Vector3(0, 0, 0) : new THREE.Vector3(4, -4, -2);
41+
private initialCameraUp = isDev() ? new THREE.Vector3(0, 1, 0) : new THREE.Vector3(-2, 4, 3);
4242
// FIXME: mobile dev 视角有问题
4343

4444
public openingAnimationStatus: 'none' | 'playing' | 'played' = isDev() ? 'played' : 'none';
@@ -81,11 +81,14 @@ export class BookScene {
8181

8282
this.camera.position.add(this.initialCameraOffset);
8383
this.camera.up.copy(this.initialCameraUp);
84-
this.camera.lookAt(0, 0, 0);
84+
85+
this.camera.lookAt(
86+
isDev() ? new THREE.Vector3(0, 0, 0) :
87+
this.isMobile ? new THREE.Vector3(1.2, 0, 0) : new THREE.Vector3(0, 2, -2));
8588

8689
// helper
87-
// const axesHelper = new THREE.AxesHelper(5);
88-
// this.scene.add(axesHelper);
90+
const axesHelper = new THREE.AxesHelper(5);
91+
this.scene.add(axesHelper);
8992

9093
}
9194

@@ -166,16 +169,16 @@ export class BookScene {
166169
const targetLookAt = new THREE.Vector3(config.pageWidth / 2, targetCameraY, 0);
167170
const targetUp = new THREE.Vector3(0, 1, 0);
168171

169-
const currentLookAt = new THREE.Vector3(0, 0, 0);
172+
const currentLookAt = this.camera.getWorldDirection(new THREE.Vector3()).clone().add(this.camera.position);
170173
const currentUp = this.camera.up.clone();
171174

172175
const tl = gsap.timeline({
173176
onComplete: () => {
174177
this.openingAnimationStatus = 'played';
175178
},
176179
onUpdate: () => {
177-
this.camera.up.copy(currentUp);
178180
this.camera.lookAt(currentLookAt);
181+
this.camera.up.copy(currentUp);
179182
},
180183
defaults: {
181184
duration: 2.5,

src/utils/env.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11

22
export function isDev() {
3+
// return false;
34
try {
4-
return import.meta.env.DEV;
5+
return import.meta.env.DEV ;
56
} catch {
67
return false;
78
}

0 commit comments

Comments
 (0)