1 Star 0 Fork 0

Kent0n/iThreeJS

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
hello-threejs.html 1.12 KB
Copy Edit Raw Blame History
longskyhs authored 2019-11-22 14:52 . Hello ThreeJS
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Hello ThreeJS</title>
<style type="text/css">
html, body {margin:0;padding:0;overflow:hidden;}
</style>
</head>
<body>
<script type="text/javascript" src="assets/js/three.min.js"></script>
<script type="text/javascript">
let camera, scene, renderer;
let geometry, material, mesh;
function init() {
camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 10);
camera.position.z = 1;
scene = new THREE.Scene();
geometry = new THREE.BoxGeometry(0.3, 0.3, 0.3);
material = new THREE.MeshNormalMaterial();
mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
renderer = new THREE.WebGLRenderer({antialias: true});
renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);
}
function animate() {
requestAnimationFrame(animate);
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.02;
renderer.render(scene, camera);
}
init();
animate();
</script>
</body>
</html>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/Kent0n/iThreeJS.git
git@gitee.com:Kent0n/iThreeJS.git
Kent0n
iThreeJS
iThreeJS
master

Search