update
This commit is contained in:
parent
f8b6e55017
commit
348c4fa06a
39
12.threejs初探.html
Normal file
39
12.threejs初探.html
Normal file
@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Three.js 初探</title>
|
||||
<link rel="stylesheet" href="/css/style.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script src="lib/three.js/three.js"></script>
|
||||
<script>
|
||||
const scene = new THREE.Scene();
|
||||
const sceneRatio = window.innerWidth / window.innerHeight;
|
||||
const camera = new THREE.PerspectiveCamera(
|
||||
50,
|
||||
sceneRatio,
|
||||
0.1,
|
||||
1000
|
||||
);
|
||||
camera.position.z = 5;
|
||||
|
||||
const renderer = new THREE.WebGLRenderer();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
const geometry = new THREE.BoxGeometry(1, 1, 1);
|
||||
const material = new THREE.MeshBasicMaterial({ color: 0xffff00 });
|
||||
const cube = new THREE.Mesh(geometry, material);
|
||||
scene.add(cube);
|
||||
|
||||
function animate() {
|
||||
requestAnimationFrame(animate);
|
||||
cube.rotation.x += 0.01;
|
||||
cube.rotation.y += 0.01;
|
||||
renderer.render(scene, camera);
|
||||
}
|
||||
animate();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
32711
lib/three.js/three.cjs
Normal file
32711
lib/three.js/three.cjs
Normal file
File diff suppressed because one or more lines are too long
32717
lib/three.js/three.js
Normal file
32717
lib/three.js/three.js
Normal file
File diff suppressed because one or more lines are too long
6
lib/three.js/three.min.js
vendored
Normal file
6
lib/three.js/three.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
50217
lib/three.js/three.module.js
Normal file
50217
lib/three.js/three.module.js
Normal file
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user