Skip to content

Commit 203d6b5

Browse files
committed
some tweaking
1 parent e223871 commit 203d6b5

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

public/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@
4141
}
4242

4343
#content {
44-
background: #FFFFFFEE;
45-
border: 1px solid black;
46-
padding: 1.2em;
44+
background: #FFFFFF;
45+
opacity: 0.88;
46+
padding: 1em;
4747
max-width: 480px;
4848
position: relative;
4949
z-index: 1;

public/scripts/skull.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,14 @@ function initializeSkull(geometry) {
6060
myMesh.geometry.computeBoundingBox();
6161

6262
const bbox = myMesh.geometry.boundingBox;
63-
myMesh.position.set(0, 0, 0);
63+
myMesh.position.set(0, 0, 2);
6464
myMesh.rotation.x = 0.2;
6565

6666
if (window.innerWidth < window.innerHeight) {
6767
myMesh.rotation.x = 0.2 - Math.PI / 2;
6868
}
69-
70-
const screenArea = window.innerWidth * window.innerHeight;
71-
const referenceArea = 1920 * 1080;
72-
const scaleFactor = Math.sqrt(screenArea / referenceArea);
7369

74-
camera.position.x = (bbox.max.x * (window.innerWidth < window.innerHeight ? 4 : 6))/ scaleFactor;
70+
camera.position.x = bbox.max.x * (5 / Math.sqrt((Math.max(window.innerWidth, 480) * window.innerHeight) / (1440 * 1196)));
7571
camera.position.y = 0;
7672
camera.position.z = 0;
7773
camera.lookAt(0, 0, 0);
@@ -105,12 +101,4 @@ window.addEventListener('resize', function () {
105101
} else {
106102
myMesh.rotation.x = 0.2;
107103
}
108-
109-
if (myMesh.geometry) {
110-
const bbox = myMesh.geometry.boundingBox;
111-
const screenArea = window.innerWidth * window.innerHeight;
112-
const referenceArea = 1920 * 1080;
113-
const scaleFactor = Math.sqrt(screenArea / referenceArea);
114-
camera.position.x = (bbox.max.x * (window.innerWidth < window.innerHeight ? 4 : 6)) / scaleFactor;
115-
}
116104
});

0 commit comments

Comments
 (0)