three实现三维圆环涡旋视觉动画效果代码

代码语言:html

所属分类:三维

代码描述:three实现三维圆环涡旋视觉动画效果代码

代码标签: three 三维 圆环 涡旋 视觉 动画

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

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

<head>
  <meta charset="UTF-8">
  

  
  
  
<style>
* {
	padding: 0;
	margin: 0;
}
</style>



  
  
</head>

<body translate="no">
  
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.128.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/OrbitControls.126.js"></script>
      <script  >
const w = window.innerWidth;
const h = window.innerHeight;

const scene = new THREE.Scene();
scene.background = new THREE.Color(0x000);
const camera = new THREE.PerspectiveCamera(75, w / h, 0.1, 100);
camera.position.z = 15;
const renderer = new THREE.WebGLRenderer();
renderer.setSize(w, h);
document.body.appendChild(renderer.domElement);

const geometry = new THREE.TorusGeometry(11, 8, 80, 100);
const material = new THREE.ShaderMaterial({
  color: 0x0033bb,
  uniforms: {
    time: { value: 0.0 } },

  vertexShader: `
        varying vec2 vUv;
        uniform float time;

        mat2 getRotationMatrix(float angle) {
            float cosA = cos(angle);
            float sinA = sin(angle);
            return mat2(cosA, -sinA, sinA, cosA);
        }

        void main() {
            vUv = uv;
            // Aplica la rotación a las coordenadas UV
            float angle = time * 0.0005; // .........完整代码请登录后点击上方下载按钮下载查看

网友评论0