three+threeasy实现夜晚高速行驶的汽车动画效果代码
代码语言:html
所属分类:动画
代码描述:three+threeasy实现夜晚高速行驶的汽车动画效果代码
代码标签: three threeasy 夜晚 高速 行驶 汽车 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> @import url("https://fonts.googleapis.com/css?family=Merriweather:400,400i,700"); * { margin: 0; } body { font-family: Merriweather, serif; } .loading { width: 100%; min-height: 100vh; display: grid; place-items: center; background: #001219; color: #e9c46a; position: absolute; top: 0; left: 0; transition: 1.5s ease-in-out; } </style> </head> <body translate="no"> <div class="loading"> <h1>Loading</h1> </div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/es-module-shims.1.6.3.js"></script> <script type="importmap"> { "imports": { "three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/160/three.module.js", "three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/160/jsm/", "threeasy": "//repo.bfw.wiki/bfwrepo/js/module/threeasy.min.js" } } </script> <script type="module"> console.clear(); import * as THREE from "three"; import { GLTFLoader } from "three/addons/loaders/GLTFLoader.js"; // import { OrbitControls } from "three/addons/controls/OrbitControls"; import Threeasy from "threeasy"; // COLORS const white = new THREE.Color(0xe9c46a); const black = new THREE.Color(0x001219); const red = new THREE.Color(0xe63946); const blue = new THREE.Color(0x457b9d); // CREATE const createDirLight = (c = 0xffffff, s = .5) => { const directionalLight = new THREE.DirectionalLight(c, s); app.scene.add(directionalLight); return directionalLight; }; const createPointLight = (c = 0xffffff, s = .5) => { const pointLight = new THREE.SpotLight(c, s); return pointLight; }; const createSpotLight = (c = 0xffffff, s = .5, w = .3) => { const spotLight = new THREE.SpotLight(c, s); // console.log(spotLight) spotLight.position.set(0, 10, 0); spotLight.castShadow = true; spotLight.shadow.mapSize.width = 1024; spotLight.shadow.mapSize.height = 1024; spotLight.shadow.camera.near = 50; spotLight.shadow.camera.far = 40; spotLight.shadow.camera.fov = 10; spotLight.distance = 0; spotLight.angle = Math.PI * w; spotLight.penumbra = 1; spotLight.decay = 1; return spotLight; }; const createLightPole = () => { const metal = new THREE.MeshPhysicalMaterial({ color: 0x4a606d, roughness: .3, metalness: 1 }); const geo = new THREE.CylinderGeometry( .2, // radiusTop .2,.........完整代码请登录后点击上方下载按钮下载查看
网友评论0