-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3文字.html
58 lines (51 loc) · 1.36 KB
/
3文字.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
position: relative;
}
span {
z-index: 100;
color: red;
position: absolute;
top: 50%;
left: 50%;
}
</style>
</head>
<body>
<span>hello three.js</span>
</body>
<script async type="module" crossorigin="anonymous">
import * as THREE from "/webGpu/3D/node_modules/three/src/Three.js";
// 这个包埋得深
// 官方更喜欢DOM + CSS写文字,而不是用threejs。
// 渲染器
const renderer = new THREE.WebGLRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
// 摄像机
const camera = new THREE.PerspectiveCamera(
45,
window.innerWidth / window.innerHeight,
1,
500
);
camera.position.set(0, 0, 100);
camera.lookAt(0, 0, 0);
// 创建场景
const scene = new THREE.Scene();
// 渲染
renderer.render(scene, camera);
</script>
</html>