three+gsap实现三维科技矩阵网格故障屏闪动画效果代码
代码语言:html
所属分类:三维
代码描述:three+gsap实现三维科技矩阵网格故障屏闪动画效果代码
代码标签: three gsap 三维 科技 矩阵 网格 故障 屏闪 动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> body { margin: 0; overflow: hidden; user-select: none;} canvas { display: block; } </style> </head> <body> <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/136/three.module.js", "addon/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/136/jsm/" } } </script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.9.1.js"></script> <script type="module"> import * as THREE from 'three'; import { OrbitControls } from 'addon/controls/OrbitControls.js'; import { FontLoader } from 'addon/loaders/FontLoader.js'; import { TextGeometry } from 'addon/geometries/TextGeometry.js'; import { EffectComposer } from 'addon/postprocessing/EffectComposer.js'; import { RenderPass } from 'addon/postprocessing/RenderPass.js'; import { UnrealBloomPass } from 'addon/postprocessing/UnrealBloomPass.js'; import { GlitchPass } from 'addon/postprocessing/GlitchPass.js'; import { ShaderPass } from 'addon/postprocessing/ShaderPass.js'; const scene = new THREE.Scene(); scene.fog = new THREE.Fog(0x000000, 10, 85); const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000); const renderer = new THREE.WebGLRenderer({ antialias: true }); renderer.setSize(window.innerWidth, window.innerHeight); document.body.appendChild(renderer.domElement); camera.position.set(0, 30, 0); gsap.to(camera.position, { duration: 3, x: Math.random() * 7 + 1, y: 0, z: 70, ease: 'circ.inOut' }); const controls = new OrbitControls(camera, renderer.domElement); controls.enableDamping = true; const floorGeometry = new THREE.PlaneGeometry(100, 100, 100, 100); const floorMaterial = new THREE.MeshStandardMaterial({ color: 0x00ff00, wireframe:true }); const floor = new THREE.Mesh(floorGeometry, floorMaterial); floor.rotation.x = - Math.PI / 2; scene.add(floor); const floorBoxGeometry = new THREE.BoxGeometry(100, 100, 100); const floorBoxMaterial = new THREE.MeshStandardMaterial({ color: 0x00FF00, wireframe:true, side: THREE.DoubleSide }); const floorBox = new THREE.Mesh(floorBoxGeometry, floorBoxMaterial); // floorBox.rotation.x = - Math.PI / 2; floorBox.position.set(0,0,0); scene.add(floorBox); const ambientLight = new THREE.AmbientLight(0xffffff, 0.5); scene.add(ambientLight); const pointLight = new THREE.PointLight(0xffffff, 1); pointLight.position.set(10, 10, 10); scene.add(pointLight); const cubes = []; const cubeGeometry = new THREE.BoxGeometry(); const cubeMaterial = new THREE.MeshStandardMaterial({ color: 0x00ff00 }); for (let i = 0; i < 500; i++) { const cube = new THREE.Mesh(cubeGeometry, cubeMaterial); cube.position.x = Math.random() * 100 - 50; cube.position.y = 0; cube.position.z = Math.random.........完整代码请登录后点击上方下载按钮下载查看
网友评论0