three实现三维带围墙三层小别墅楼房代码
代码语言:html
所属分类:三维
代码描述:three实现三维带围墙三层小别墅楼房代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Three.js 现代别墅带围墙</title>
<style>
html, body {
margin: 0;
width: 100%;
height: 100%;
overflow: hidden;
background: #b9c7d8;
font-family: Arial, Helvetica, sans-serif;
}
#info {
position: absolute;
top: 10px;
left: 10px;
z-index: 10;
padding: 8px 12px;
background: rgba(255,255,255,0.85);
border-radius: 8px;
color: #333;
font-size: 14px;
line-height: 1.6;
}
</style>
</head>
<body>
<div id="info">
鼠标左键旋转|滚轮缩放|右键平移<br/>
Three.js 现代别墅(带围墙)
</div>
<script type="importmap">
{
"imports":{
"three":"//repo.bfw.wiki/bfwrepo/js/module/three/build/164/three.module.js",
"three/addons/":"//repo.bfw.wiki/bfwrepo/js/module/three/examples/164/jsm/"
}
}
</script>
<script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
const scene = new THREE.Scene();
scene.background = new THREE.Color(0xb7c4d6);
scene.fog = new THREE.Fog(0xb7c4d6, 80, 180);
const camera = new THREE.PerspectiveCamera(
55,
window.innerWidth / window.innerHeight,
0.1,
1000
);
camera.position.set(38, 28, 42);
const renderer = new THREE.WebGLRenderer({ antialias: true });
renderer.setSize(window.innerWidth, window.innerHeight);
renderer..........完整代码请登录后点击上方下载按钮下载查看
















网友评论0