办公园区建筑科技风效果(html+threejs)

办公楼科技风(Html+threejs)

初始化三维场景

复制代码
function init() {

    container = document.getElementById('container');

    camera = new THREE.PerspectiveCamera(65, window.innerWidth / window.innerHeight, 0.1, 150000000);
    camera.position.set(550, 600, 690);

    scene = new THREE.Scene();
    // scene.background = new THREE.Color(0x426ab3);
    scene.background = new THREE.Color(0x0);

    renderer = new THREE.WebGLRenderer({
        //logarithmicDepthBuffer: true,  // 使用精度更高的z缓冲
        antialias: true,  // 设置抗锯齿,
        alpha: true       // 是否可以设置背景色透明。必须设置为true,才能出现镜头光晕效果
    });
    renderer.setPixelRatio(window.devicePixelRatio);
    renderer.setSize(window.innerWidth, window.innerHeight);
    container.appendChild(renderer.domElement);

    // const light = new THREE.HemisphereLight(0xffffff, 0x909090, 0.8);
    // scene.add(light);
    const light = new THREE.AmbientLight( 0xffffff,1 ); // soft white light
    scene.add( light );

    const directionalLight = new THREE.DirectionalLight(0xffffff, 0.5);
    directionalLight.position.set(550, 4600, 690);
    scene.add(directionalLight);

    const light2 = new THREE.PointLight( 0xffffff, 0.25 );
    light2.position.set( 1550, 3500, 0 );
    scene.add( light2 );

    controls = new THREE.OrbitControls(camera, renderer.domElement);
    // controls.minDistance = 1;
    // controls.maxDistance = 100000;
    controls.target.set(0, 1, 0);
    controls.update();

    stats = new Stats();
    container.appendChild(stats.dom);

    window.addEventListener('resize', onWindowResize, false);

}

办公楼科技风2(Html+threejs)

​​​​​​​

办公园区科技风效果(Html+threejs)

相关推荐
星辰中的维纳斯37 分钟前
vue新手入门教程(项目创建+组件导入+VueRouter)
前端·javascript·vue.js
嫣嫣细语1 小时前
css实现鼠标禁用(鼠标滑过显示红色禁止符号)
前端·css
Days20501 小时前
web前端主要包括哪些技术
前端
XF鸭1 小时前
HTML-CSS 入门介绍
服务器·前端·javascript
forwardMyLife2 小时前
element-plus 的form表单组件之el-radio(单选按钮组件)
前端·javascript·vue.js
fs哆哆2 小时前
ExcelVBA运用Excel的【条件格式】(二)
linux·运维·服务器·前端·excel
安冬的码畜日常2 小时前
【CSS in Depth 2精译】2.5 无单位的数值与行高
前端·css
ilisi_3 小时前
导航栏样式,盒子模型
前端·javascript·css
吉吉安3 小时前
grid布局下的展开/收缩过渡效果【vue/已验证可正常运行】
前端·javascript·vue.js
梦凡尘3 小时前
Vue3 对跳转 同一路由传入不同参数的页面分别进行缓存
前端·javascript·vue.js