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

做体育网站石碣镇做网站

做体育网站,石碣镇做网站,网络营销广告案例,宁夏建设局官方网站参考资料 三维向量Vector3与模型位置…克隆.clone()和复制.copy() 知识点 注:基于Three.jsv0.155.0 三维向量Vector3与模型位置欧拉Euler与角度属性.rotation模型材质颜色(Color对象)模型材质父类Material:透明、面属性模型材质和几何体属性克隆.clo…

参考资料

  • 三维向量Vector3与模型位置
  • 克隆.clone()和复制.copy()

知识点

注:基于Three.jsv0.155.0

  • 三维向量Vector3与模型位置
  • 欧拉Euler与角度属性.rotation
  • 模型材质颜色(Color对象)
  • 模型材质父类Material:透明、面属性
  • 模型材质和几何体属性
  • 克隆.clone()和复制.copy()

代码实现

<!DOCTYPE html>
<html lang="en">
<head><meta charset="UTF-8"><title>Three.js</title>
</head><body></body><!-- 具体路径配置,你根据自己文件目录设置,我的是课件中源码形式 --><script type="importmap">{"imports": {"three": "./js/three.module.js","three/addons/": "../three.js/examples/jsm/"}}</script><script type="module">import * as THREE from 'three';import { OrbitControls } from 'three/addons/controls/OrbitControls.js';const width = 800const height = 500// 场景const scene = new THREE.Scene();// 几何体const geometry = new THREE.BoxGeometry(100, 100, 100);// 材质 const material = new THREE.MeshBasicMaterial({color:0x0000ff,});// 网格模型:物体const mesh = new THREE.Mesh(geometry, material);// 位置属性mesh.position.set(0, 0, 0);// mesh.position.x = 100;// mesh.scale.set(2, 2, 2);// mesh.scale.x = 2;// mesh.translateOnAxis(new THREE.Vector3(1, 0, 1), 100);// mesh.translateX(100);scene.add(mesh);// 角度属性// mesh.rotation.x = Math.PI / 4;// mesh.rotation.set(0, 0, Math.PI / 4);// mesh.rotateX(Math.PI / 4);console.log('🚀 ~ file: 3.1三维向量Vector3与模型位置.html:46 ~ mesh.rolation:', mesh.rotation)// 材料颜色// mesh.material.color.set('red');// mesh.material.color.set('#ff0000');// mesh.material.color.set(0xff0000);mesh.material.color.r = 1;// 材料透明度mesh.material.opacity = 0.8;mesh.material.transparent = true; // 是否透明// 材料面属性// mesh.material.side = THREE.FrontSide; // 正面可见mesh.material.side = THREE.DoubleSide; // 两面可见console.log('🚀 ~ file: 3.1三维向量Vector3与模型位置.html:66 ~ mesh.material.side:', mesh.material.side) // 2console.log('🚀 ~ file: 3.1三维向量Vector3与模型位置.html:63 ~ mesh.material:', mesh.material)console.log('🚀 ~ file: 3.1三维向量Vector3与模型位置.html:89 ~ mesh.geometry:', mesh.geometry)// 克隆、复制const mesh2 = mesh.clone();mesh2.position.set(200, 0, 0);mesh2.material = mesh.material.clone();mesh2.material.color.set(0xff0000);mesh2.position.copy(mesh.position);mesh2.position.y += 150;scene.add(mesh2);// 坐标系const axes = new THREE.AxesHelper(200);scene.add(axes);// 相机const camera = new THREE.PerspectiveCamera(75, width/height, 0.1, 1000);camera.position.set(200, 200, 200);camera.lookAt(scene.position);// 渲染器const renderer = new THREE.WebGLRenderer();renderer.setSize(width, height);renderer.render(scene, camera);document.body.appendChild(renderer.domElement);// 控制器const controls = new OrbitControls(camera, renderer.domElement);controls.addEventListener('change', () => {renderer.render(scene, camera);});// 渲染循环function render() {mesh.rotateY(0.01);// mesh旋转动画// 同步mesh2和mesh的姿态角度一样,不管mesh姿态角度怎么变化,mesh2始终保持同步mesh2.rotation.copy(mesh.rotation);renderer.render(scene, camera);requestAnimationFrame(render);}render();</script>
</html>
http://www.15wanjia.com/news/162422.html

相关文章:

  • wordpress 仿站vip企业管理培训课程
  • 深圳企业网站制作正确建设企业网站
  • 房地产网站建设公司网站常见错误
  • python做h5网站网站设计需求书
  • wordpress有没有ssrpanel网站建设优化服务公司
  • 做设计参考的网站聚财三个字公司名字
  • 查网站注册信息策划公司名称
  • 百度下载安装app天津seo排名公司
  • 内蒙古建设工程造价信息网seo网络推广怎么做
  • 南岸集团网站建设南昌市建设工程质量监督站网站
  • 福建省城乡建设官方网站设计师招聘
  • 网站开发交什么税和田地seo
  • 备案网站电子照幕布wordpress无法将上传的文件移动至
  • 自己开发微网站网上哪个网站教做西点
  • 网站整套模板wordpress 端口映射
  • 博白建设局网站下载建设银行官方网站下载
  • 摄影的网站设计特点wordpress中英文菜单
  • 网站模板使用教程黄冈网站建设报价表
  • 黑龙江能源建设网站网店代运营一年的费用是多少
  • 微信小程序 购物网站开发架构图在什么网站可以做
  • 涡阳网站优化wordpress 医院主题
  • 如何用微信做网站全国市场主体登记注册服务网
  • 网站建设运营的灵魂是什么重庆最新宣传片
  • wordpress生产静态页面php网站开发优化方案
  • 网站怎么做实名认证php做网站示例
  • 区块链 做网站成品网站1688入口网页版怎样
  • 建网站需要哪些网站开发体会范文
  • 如何面试网站开发网站建设制作报价方案
  • 仪器仪表行业网站建设论坛类型的网站怎么做
  • 网站地图分析工具长安网站建设好吗