three实现炫酷三维发光点线弯曲动画效果代码

代码语言:html

所属分类:三维

代码描述:three实现炫酷三维发光点线弯曲动画效果代码

代码标签: three 炫酷 三维 发光 点线 弯曲 动画

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">


  
  
<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  overflow: hidden;
}
.canvas-container {
  height: 100vh;
  width: 100vw;
  background: #6a558e;
}
</style>


</head>

<body  >
  <div class='canvas-container'></div>

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.0.99.0..js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/OrbitControls.0.99.0..js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/EffectComposer.0.99.0.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/RenderPass.0.99.0.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/ShaderPass.0.99.0.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/CopyShader.0.99.0.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/LuminosityHighPassShader.0.99.0.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/UnrealBloomPass.0.99.0.js"></script>


<script id='sphere-vertex-shader' type='x-shader/x-vertex'>
    uniform float uTime;
    
    varying vec3 vNormal;
    varying vec3 vPosition;
    

    void main() {
        vNormal = normal;
        
        vec3 delta = 40.0 * normal * sin(
            abs(normal.x) * 2.0 +
            abs(normal.y) * 3.0 +
            abs(normal.z) * 4.0 + uTime / 2.0);
        
        delta.x += 20.0 * sin(uTime * normal.z);
        delta.y += 20.0 * sin(uTime * normal.x);
        delta.z += 20.0 * sin(uTime * normal.y);
        
        vec3 newPosition = position + delta;
        
        vPosition = newPosition;

        gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition, 1.0);
        gl_PointSize = 1.0;
    }
    

</script>


<script id='sphere-fragment-shader' type='x-shader/x-fragment'>
    uniform float uTime;
    
    varying vec3 vNormal;
    varying vec3 vPosition;
    
    
    void main() {
        gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
    }
    
</script>

  
      <script  >
let SCENE;
let CAMERA;
let RENDERER;
let CONTROLS;
let COMPOSER;

let TIME = 10; // Let it be non zero at start


main();


function main() {
  init();
  animate();
}


function init() {
  initScene();
  initCamera();
  initRenderer();
  initComposer();
  initControls();
  initEventListeners();

  crea.........完整代码请登录后点击上方下载按钮下载查看

网友评论0