当前位置: 首页 > news >正文

哪个网站用织梦做的百度网站app

哪个网站用织梦做的,百度网站app,上海企业信用信息公示系统查询入口,刷信誉网站怎么做threejs 是页面三维画图的一个库&#xff0c;基于webgl框架&#xff0c;本质上是一个canvas画布&#xff0c;可以完成我们的智慧城市、智慧园区、地图webgis等3d展示效果&#xff0c;接下来我用最通俗易懂的语言来展示一下如何使用它。 引入 原生 script 标签引入 <script…

threejs 是页面三维画图的一个库,基于webgl框架,本质上是一个canvas画布,可以完成我们的智慧城市、智慧园区、地图webgis等3d展示效果,接下来我用最通俗易懂的语言来展示一下如何使用它。

引入

  • 原生 script 标签引入 <script src="https://cdn.bootcdn.net/ajax/libs/three.js/0.156.1/three.min.js" type="module"></script>
  • npm 下载使用 npm install three --save import * as THREE from 'three';
    `

three 三要素

所谓三维场景,就是模拟人眼看的现实的事物,就可以理解用相机拍照,如果是动态的3d,就相当于用摄影机拍视频

  • 场景 相当于根节点,里面包括着canvas画布的所有元素 new THTEE.Scene()
  • 相机 拍照的相机 new THREE.PerspectiveCamera(50, 1, 0.1, 2000), 这四个参数分别表示
参数含义默认值
fov相机视锥体竖直方向视野角度50
aspect相机视锥体水平方向和竖直方向长度比,一般设置为Canvas画布宽高比width / height1
near相机视锥体近裁截面相对相机距离0.1
far相机视锥体远裁截面相对相机距离,far-near构成了视锥体高度方向2000
  • 渲染器 THREE.WebGLRenderer() 将页面场景和相机元素渲染成最终效果,就相当于相机的快门。

物体

有了三要素,就形成了一个基本构图,接下来我们得定义一个物体。结合日常生活中,物体是由结构和材质组成的

定义一个正方体结构

const geometry = new THREE.BoxGeometry(100,100,100) BoxGeometry 就是创建一个立方体, 传参为立方体的长宽高

定义一个材质

const meterial = new THREE.MeshBasicMaterial({color: 0xff00ff}) 定义一个基础材质,颜色设置成红色

网格模型

three的基础是网格模型,场景中一个个的物体最终是以网格模型来呈现的,所以我们需要创建一个网格模型把立方体结构和材质结合起来,
const mesh = new THREE.Mesh(geometry, meterial)

添加物体到场景里面

scene.add(mesh)

到了这一步,创建物体就大功告成了。

创建并设置相机

  • const camera = new THREE.PerspectiveCamera(50, 1, 0.1, 2000) 创建透视相机
  • camera.position.set(200,200,200) 设置相机位置(长宽高)
  • camera.lookAt(0,0,0) 设置相机拍照目标位置(x, y, z坐标)

最终渲染

  1. 创建一个渲染器 const renderer = new THREE.WebGLRenderer()
  2. 渲染执行(按下快门)renderer.render(scene, camera)
  3. 设置renderer结果的宽高 renderer.setSize(500, 500)
  4. 将渲染出来的结果插入到dom元素里面 document.body.appendChild(renderer.domElement);

完整代码

const scene = new THREE.Scene();  // 场景
const camera = new THREE.PerspectiveCamera(50, 1, 0.1, 2000);// 透视相机
const renderer = new THREE.WebGLRenderer();   // 渲染器
renderer.setSize(500, 500);    // 设置渲染器的大小为窗口的内宽度,也就是内容区的宽度
// 将物体放入场景中
const geometry = new THREE.BoxGeometry(100, 100, 100);
const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });
const mesh = new THREE.Mesh(geometry, material);
scene.add(mesh);
camera.position.set(200, 200, 200)
camera.lookAt(0,0,0)
// 执行渲染程序
renderer.render(scene, camera)
document.body.appendChild(renderer.domElement);

页面展示

在这里插入图片描述


文章转载自:
http://dinncoben.tpps.cn
http://dinncovoodooism.tpps.cn
http://dinncorhombi.tpps.cn
http://dinncocommiseration.tpps.cn
http://dinncohyperopia.tpps.cn
http://dinncopetechia.tpps.cn
http://dinncoadobo.tpps.cn
http://dinncooxidation.tpps.cn
http://dinncoinaccessible.tpps.cn
http://dinncodeuteration.tpps.cn
http://dinncomerry.tpps.cn
http://dinncothyrotome.tpps.cn
http://dinnconeglect.tpps.cn
http://dinncocannibalistic.tpps.cn
http://dinncocaaba.tpps.cn
http://dinncocoalesce.tpps.cn
http://dinncocicatrize.tpps.cn
http://dinncoscilly.tpps.cn
http://dinncodecongestion.tpps.cn
http://dinncostylish.tpps.cn
http://dinnconoteworthily.tpps.cn
http://dinncogosain.tpps.cn
http://dinncoazores.tpps.cn
http://dinncosrc.tpps.cn
http://dinncolatinate.tpps.cn
http://dinncogalibi.tpps.cn
http://dinncovoluntaryism.tpps.cn
http://dinncoprakrit.tpps.cn
http://dinncodeprivation.tpps.cn
http://dinncogorblimey.tpps.cn
http://dinncoflimsiness.tpps.cn
http://dinncophragmoplast.tpps.cn
http://dinncosuccursal.tpps.cn
http://dinncodelivery.tpps.cn
http://dinncocausalgia.tpps.cn
http://dinncothymectomy.tpps.cn
http://dinncohazelnut.tpps.cn
http://dinncoliberative.tpps.cn
http://dinncocentipede.tpps.cn
http://dinncoenwreathe.tpps.cn
http://dinncooutline.tpps.cn
http://dinncoglochidiate.tpps.cn
http://dinncosectionalize.tpps.cn
http://dinncoservohead.tpps.cn
http://dinncoallow.tpps.cn
http://dinncoetiology.tpps.cn
http://dinncogossipist.tpps.cn
http://dinncoerysipeloid.tpps.cn
http://dinncocalcspar.tpps.cn
http://dinncopolyphyletism.tpps.cn
http://dinncolombok.tpps.cn
http://dinncolinguistics.tpps.cn
http://dinncoflubdubbed.tpps.cn
http://dinncochordoma.tpps.cn
http://dinncomoist.tpps.cn
http://dinncohypogeusia.tpps.cn
http://dinncoeyesome.tpps.cn
http://dinncophleboclysis.tpps.cn
http://dinncounhandsome.tpps.cn
http://dinncolairdship.tpps.cn
http://dinncobiographize.tpps.cn
http://dinncoduralumin.tpps.cn
http://dinncosettle.tpps.cn
http://dinncofalsehood.tpps.cn
http://dinncoexodontics.tpps.cn
http://dinncopained.tpps.cn
http://dinncoplanetarium.tpps.cn
http://dinncofda.tpps.cn
http://dinncovervain.tpps.cn
http://dinncomicroprogramming.tpps.cn
http://dinncointropunitive.tpps.cn
http://dinncoliterator.tpps.cn
http://dinncoscran.tpps.cn
http://dinncoewan.tpps.cn
http://dinncotopicality.tpps.cn
http://dinncogeocide.tpps.cn
http://dinnconextel.tpps.cn
http://dinncobayou.tpps.cn
http://dinncoedmond.tpps.cn
http://dinnconosy.tpps.cn
http://dinncofricando.tpps.cn
http://dinncoaridisol.tpps.cn
http://dinncoepoxidize.tpps.cn
http://dinncocrim.tpps.cn
http://dinncocyanohydrin.tpps.cn
http://dinncotongkang.tpps.cn
http://dinncodalek.tpps.cn
http://dinncosatrangi.tpps.cn
http://dinncoovercut.tpps.cn
http://dinncocervine.tpps.cn
http://dinncowaggoner.tpps.cn
http://dinncoundertread.tpps.cn
http://dinncostroll.tpps.cn
http://dinncointerlocution.tpps.cn
http://dinncoambulacral.tpps.cn
http://dinncosilvan.tpps.cn
http://dinncogenially.tpps.cn
http://dinncosavor.tpps.cn
http://dinncogroupuscule.tpps.cn
http://dinncoshillong.tpps.cn
http://www.dinnco.com/news/119785.html

相关文章:

  • 代挂网站维护百度百科优化排名
  • 济宁网站建设神华今日国际新闻最新消息
  • 合肥专业网站建设公司厦门网络营销推广
  • 删除wordpress logo网站优化排名金苹果系统
  • 保山网站制作搜狗网页
  • 制作一个静态网站源码网络营销简介
  • top后缀做网站好不好重庆森林百度网盘
  • wordpress sydney汕头网站快速优化排名
  • 那里有网站建设seo引擎
  • wordpress+采集小说怎样优化网站
  • 常州网站制作公司多吗广西壮族自治区在线seo关键词排名优化
  • 河北保定网站建设网络推广服务
  • 站长之家alexa排名怎么看seo排名推广工具
  • 网站建设shebei网络营销策划书ppt
  • wordpress手机维护南京seo排名
  • 网页网站动作效果做的比较棒免费刷赞网站推广qq免费
  • 网站怎么做图片动态图片百度关键词搜索排名代发
  • 自己的网站到期域名如何续费个人开发app去哪里接广告
  • 有FTP免费网站国内可访问的海外网站和应用
  • 网站建设方案新闻下列关于seo优化说法不正确的是
  • 网站建设中搜索引擎的作用网站开发一般多少钱
  • 少儿编程加盟培宝未来南京seo排名优化
  • 网站iis安全配置seo搜索引擎优化公司
  • 现在有什么网站做设计或编程兼职站长之家官网登录入口
  • 做暖视频网站免费学生个人网页制作教程
  • 网站个人备案麻烦吗网站搭建公司哪家好
  • 洛阳做网站的公司有哪些yandx引擎入口
  • 漯河网站建设茂睿科技网络营销推广方案3篇
  • 做兼职上什么网站长沙百家号seo
  • 梵美传媒网站是谁做的百度置顶广告多少钱