three+gsap+dat.gui实现可配置参数三维色带旋转动画效果代码

代码语言:html

所属分类:三维

代码描述:three+gsap+dat.gui实现可配置参数三维色带旋转动画效果代码

代码标签: three gsap dat.gu 配置 参数 三维 色带 旋转 动画

下面为部分代码预览,完整代码请点击下载或在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="importmap">
  {
    "imports": {      
      "three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/136/three.module.js",
		     
      "three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/164/jsm/"
    }
  }
</script>
      <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.8.0.js"></script>
    <script type="module">
      import * as THREE from 'three';
      import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
      import { UnrealBloomPass } from 'three/addons/postprocessing/UnrealBloomPass.js';
      import { EffectComposer } from 'three/addons/postprocessing/EffectComposer.js';
      import { RenderPass } from 'three/addons/postprocessing/RenderPass.js';
      import { ShaderPass } from 'three/addons/postprocessing/ShaderPass.js';
      import { DotScreenPass } from 'three/addons/postprocessing/DotScreenPass.js';
      import { GlitchPass } from 'three/addons/postprocessing/GlitchPass.js';
      import { GUI } from '//repo.bfw.wiki/bfwrepo/js/module/dat.gui.js';
     

      const scene = new THREE.Scene();
      const camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 0.1, 1000);

      const renderer = new THREE.WebGLRenderer({ antialias: true });
      renderer.setPixelRatio(window.devicePixelRatio);
      // renderer.setPixelRatio(window.devicePixelRatio * 1.5);
      renderer.setSize(window.innerWidth, window.innerHeight);
      document.body.appendChild(renderer.domElement);

      const controls = new OrbitControls(camera, renderer.domElement);
      controls.enableDamping = true;

      camera.position.set(0, 0, 40);

      const composer = new EffectComposer(renderer);

      let ribbons = [];
      const ribbonCount = 30;
      const group = new THREE.Group();
      scene.add(group);

      let guiParams = {
        deformAmount: 0.1,
        transparency: 0.5,
        iridescenceIntensity: 1.0,
        noiseStrength: 0.2,
        bloomStrength: 0.5,
        bloomRadius: 2,
        bloomThreshold: 0,
        activateGlitch: false,
        dotScale: 0.1,
        activateDotScreen: false
      };

      const light = new THREE.AmbientLight(0xffffff, 1);
      scene.add(light);

      const pointLight = new THREE.PointLight( 0xff0000, 1, 100 );
      pointLight.position.set( 50, 50, 50 );
      pointLight.castShadow = true;
      scene.add( pointLight );

      pointLight.shadow.mapSize.width = 512; // default
      pointLight.shadow.mapSize.height = 512; // default
      pointLight.shadow.camera.near = 0.5; // default
      pointLight.shadow.camera.far = 500; // default

      /*
      const curve = new THREE.CatmullRomCurve3( [
        new THREE.Vector3(-10, 0, 0),
        new THREE.Vector3(-5, 5, 5),
        new THREE.Vector3(0, 0, 10),
        new THREE.Vector3(5, -5, 5),
        new THREE.Vector3(10, 0, 0),
        new THREE.Vector3(5, 5, -5),
        new THREE.Vector3(0, 0, -10),
        new THREE.Vector3(-5, -5, -5),
        new THREE.Vector3(-10, 0, 0)
      ] );

      const points = curve.getPoints( 50 );
      const geometry = new THREE.BufferGeometry().setFromPoints( points );
      const material = new THREE.LineBasicMaterial( { color: 0xff0000 } );
      const curveObject = new THREE.Line( geometry, material );
      */

      function createRibbons() {
        for (let i = 0; i < ribbonCount; i++) {
          const geometry = new THREE.T.........完整代码请登录后点击上方下载按钮下载查看

网友评论0