three实现三维彩虹线条飞舞动画效果代码
代码语言:html
所属分类:三维
代码描述:three实现三维彩虹线条飞舞动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<html lang="en"> <head> <meta charset="UTF-8"> <style> canvas { display: block; width: 100%; height: 100vh; cursor: -webkit-grab; cursor: grab; } </style> </head> <body> <canvas width="887" height="448" style="display: block;"></canvas> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.9.1.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.147.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/OrbitControls.145.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/CopyShader.146.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/EffectComposer.146.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/ShaderPass.146.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/RenderPass.146.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/LuminosityHighPassShader.146.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/UnrealBloomPass.146.js"></script> <script type="module"> const renderer = new THREE.WebGLRenderer({ antialias: true }); const scene = new THREE.Scene(); const camera = new THREE.PerspectiveCamera(75, 2, .1, 1000); const controls = new THREE.OrbitControls(camera, renderer.domElement); window.addEventListener('resize', () => { const { clientWidth, clientHeight } = renderer.domElement; renderer.setSize(clientWidth, clientHeight, false); renderer.setPixelRatio(window.devicePixelRatio); camera.aspect = clientWidth / clientHeight; camera.updateProjectionMatrix(); }); document.body.prepend(renderer.domElement); window.dispatchEvent(new Event('resize')); //// Setup camera.position.set(-2, 8, 2); const light0 = new THREE.DirectionalLight('white', 1); light0.position.set(2,.........完整代码请登录后点击上方下载按钮下载查看
网友评论0