three实现三维人头点云粒子交互效果代码
代码语言:html
所属分类:粒子
代码描述:three实现三维人头点云粒子交互效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> .particlehead { background: #abe1fd; } h1 { font-size: 35px; color: #202022; font-family: Montserrat, sans-serif; position: absolute; left: 50%; top: 50%; text-transform: uppercase; font-weight: normal; margin-left: -304px; margin-top: -20px; pointer-events: none; } h1 strong { font-weight: 700; } h1 em { font-family: "Playfair Display", serif; text-transform: lowercase; font-style: italic; } </style> <script type="importmap"> { "imports": { "three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/169/three.module.js", "three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/169/jsm/" } } </script> </head> <body translate="no"> <div class="particlehead"></div> <h1><strong>WebGL</strong> head made <em>of</em> particles</h1> <script type="module"> import * as THREE from "three"; import { OBJLoader } from "three/addons/loaders/OBJLoader.js"; const Background = {}; function init() { // Set dimensions const width = window.innerWidth; const height = window.innerHeight; let camera, scene, renderer, mouseX = 0, mouseY = 0, p; let windowHalfX = width / 2; let windowHalfY = height / 2; // Camera camera = new THREE.PerspectiveCamera(35, width / height, 1, 2000); camera.position.z = 300; // Scene scene = new THREE.Scene(); // Texture Manager const manager = new THREE.LoadingManager(); manager.onProgress = function (item, loaded, total) { console.log(item, loaded, total); }; // Particles const p_geom = new THREE.BufferGeometry(); const p_material = new THREE.PointsMaterial({ color: 0xffffff, size: 1.5 }); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0