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

php网站开发路线长沙官网seo分析

php网站开发路线,长沙官网seo分析,福州专业网站建设网络公司,手机网站建设cz35three.js实现电子围栏效果&#xff08;纹理贴图&#xff09; 实现步骤 围栏的坐标坐标转换为几何体顶点&#xff0c;uv顶点坐标加载贴图&#xff0c;移动 图例 代码 <template><div class"app"><div ref"canvesRef" class"canvas-…

three.js实现电子围栏效果(纹理贴图)

实现步骤

  1. 围栏的坐标
  2. 坐标转换为几何体顶点,uv顶点坐标
  3. 加载贴图,移动

图例

在这里插入图片描述

代码

<template><div class="app"><div ref="canvesRef" class="canvas-wrap"></div></div>
</template><script setup>
import { ref, onMounted } from "vue";
import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";const canvesRef = ref(null);
const canvasWidth = window.innerWidth;
const canvasHeight = window.innerHeight;
let scene;
let camera;
let renderer;
let axesHelper;
let cameraControls;init();
render();
function init() {// 场景scene = new THREE.Scene();// 模型addModel();// 相机camera = new THREE.PerspectiveCamera(75,canvasWidth / canvasHeight,0.1,3000);camera.position.set(300, 300, 300);// camera.lookAt(0, 0, 0);// 坐标辅助对象axesHelper = new THREE.AxesHelper(200);scene.add(axesHelper);// 渲染器//antialias - 是否执行抗锯齿。默认为false.renderer = new THREE.WebGLRenderer();renderer.setSize(canvasWidth, canvasHeight);// 相机轨道控制器cameraControls = new OrbitControls(camera, renderer.domElement);
}
function addModel() {// 坐标const points = [[0, 0, 0],[0, 0, 200],[200, 0, 200],[200, 0, 0],[0, 0, 0],];const height = 30; // 高度const color1 = "#ff00ff"; // 颜色// 围栏距离 累加const pointDistance = [];// 围栏总长度const distance = points.reduce((totalDistance, point, index) => {let segmentDistance = 0;if (index > 0) {let lastPoint = new THREE.Vector3(...points[index - 1]);let currPoint = new THREE.Vector3(...point);segmentDistance = lastPoint.distanceTo(currPoint);}totalDistance += segmentDistance;pointDistance.push(totalDistance);return totalDistance;}, 0);// console.log(distance, pointDistance);// 几何体const geometry = new THREE.BufferGeometry(); // 缓冲几何体const posArr = [];const uvArr = [];// 遍历坐标// posArr 几何体顶点points.forEach((point, index) => {if (index == 0) return;const lastPoint = points[index - 1];// 三角面1posArr.push(...lastPoint);uvArr.push(pointDistance[index - 1] / distance, 0);posArr.push(...point);uvArr.push(pointDistance[index] / distance, 0);posArr.push(lastPoint[0], lastPoint[1] + height, lastPoint[2]);uvArr.push(pointDistance[index - 1] / distance, 1);// 三角面2posArr.push(...point);uvArr.push(pointDistance[index] / distance, 0);posArr.push(point[0], point[1] + height, point[2]);uvArr.push(pointDistance[index] / distance, 1);posArr.push(lastPoint[0], lastPoint[1] + height, lastPoint[2]);uvArr.push(pointDistance[index - 1] / distance, 1);});console.log(posArr, uvArr);geometry.setAttribute("position",new THREE.BufferAttribute(new Float32Array(posArr), 3));geometry.setAttribute("uv",new THREE.BufferAttribute(new Float32Array(uvArr), 2));// 纹理const texture = new THREE.TextureLoader().load("../src/assets/img/icon.png");texture.wrapS = THREE.RepeatWrapping;texture.wrapT = THREE.RepeatWrapping;// 材质const material = new THREE.MeshBasicMaterial({// color: color1,map: texture,transparent: true,opacity: 1,depthWrite: false,side: THREE.DoubleSide,});// 创建围栏const mesh = new THREE.Mesh(geometry, material);scene.add(mesh);texture.repeat.set(10, 1); // 平铺textrue_offset(texture, "top", 5);
}
function textrue_offset(texture, direction = "right", speed = 0.5) {// 开始时间const start = Date.now();const h = () => {requestAnimationFrame(h);const now = Date.now();const offset = ((now - start) / 1000) * speed;switch (direction) {case "left":texture.offset = new THREE.Vector2(offset, 0); //纹理偏移break;case "right":texture.offset = new THREE.Vector2(-offset, 0);break;case "top":texture.offset = new THREE.Vector2(0, -offset);break;case "left":texture.offset = new THREE.Vector2(0, offset);break;}};h();
}
function render() {renderer.render(scene, camera);requestAnimationFrame(render);
}
onMounted(() => {canvesRef.value.appendChild(renderer.domElement);
});
</script><style lang="scss" scoped>
.app {position: relative;
}
</style>
http://www.15wanjia.com/news/14023.html

相关文章:

  • 网站建设和管理是教什么科目火蝠电商代运营公司
  • 做网站外包给淘宝好吗重庆百度推广关键词优化
  • 辽阳哪里做网站百度主页入口
  • 双wan路由器做网站接入上海抖音seo
  • 做网站用什么编程语言好有域名和服务器怎么建网站
  • 广州外贸公司网站建设飓风seo刷排名软件
  • 微信短网址生成太原seo外包平台
  • 如何开发一个直播平台seo查询友情链接
  • 黑龙江省关于城市建设政策网站谷歌浏览器下载官网
  • 玉树营销网站建设公司如何做网站关键词优化
  • wordpress当前页询价汕头网站排名优化
  • 网站常用的优化方法广州外贸推广
  • 做网站做地区好还是全国的好论坛seo教程
  • 启东网站建设公司市场营销毕业后做什么工作
  • 传媒网站建设seo在哪可以学
  • 做b612表情的素材网站360推广怎么收费
  • 网站开发的布局划分百度网首页
  • 福州做网站建设百度网盘app下载安装 官方下载
  • 手机网站开发语言选择北京seo推广优化
  • 体彩网站建设微信营销推广
  • 什么免费网站可以链接域名长沙关键词优化方法
  • 最优惠的赣州网站建设年轻人不要做网络销售
  • 建外贸网站用什么主机b站视频推广网站
  • 做关于手机的网站 该如何设计怎么做好市场宣传和推广
  • 网站建设外文文献百度排行榜风云榜
  • 做救助流浪动物网站的产生背景百度竞价广告怎么收费
  • 做网站时 404网页如何指向成品视频直播软件推荐哪个好一点
  • 手机网站模板图片最近几天的新闻大事
  • 做门户网站需要什么条件流量神器
  • 吉林省住房建设厅网站国际局势最新消息今天