gsap和threejs实现三维圆体内部空气燃烧喷发动画效果代码

代码语言:html

所属分类:三维

代码描述:gsap和threejs实现三维圆体内部空气燃烧喷发动画效果代码

代码标签: 实现 三维 圆体 内部 空气 燃烧 喷发 动画 效果

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

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

<head>

  <meta charset="UTF-8">

  
  
<style>
canvas {
    width: 100%;
    height: 100vh;
    display: block;
}
</style>




</head>

<body >

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/gsap.3.5.2.js"></script>
      <script type="module">
import * as $ from '//unpkg.com/three@0.123.0/build/three.module.js';
import { OrbitControls } from '//unpkg.com/three@0.123.0/examples/jsm/controls/OrbitControls.js';
import { EffectComposer } from '//unpkg.com/three@0.123.0/examples/jsm/postprocessing/EffectComposer';
import { RenderPass } from '//unpkg.com/three@0.123.0/examples/jsm/postprocessing/RenderPass';
import { UnrealBloomPass } from '//unpkg.com/three@0.123.0/examples/jsm/postprocessing/UnrealBloomPass';

// ----
// Boot
// ----

const renderer = new $.WebGLRenderer({ antialias: true });
const scene = new $.Scene();
const camera = new $.PerspectiveCamera(75, 2, .01, 1000);
const cubeRT = new $.WebGLCubeRenderTarget(128);
const cubeCamera = new $.CubeCamera(.01, 1000, cubeRT);
const composer = new EffectComposer(renderer);
const controls = new OrbitControls(camera, renderer.domElement);
const bufSize = new $.Vector2();
window.addEventListener('resize', () => {
  const { clientWidth, clientHeight } = renderer.domElement;
  renderer.setPixelRatio(window.devicePixelRatio);
  renderer.setSize(clientWidth, clientHeight, false);
  camera.aspect = clientWidth / clientHeight;
  camera.updateProjectionMatrix();
  composer.setPixelRatio(window.devicePixelRatio);
  composer.setSize(clientWidth, clientHeight);
  renderer.getDrawingBufferSize(bufSize);
});
document.body.prepend(renderer.domElement);
window.dispatchEvent(new Event('resize'));

// ----
// Main
// ---- 
// https://unsplash.com/photos/_bFj2QHsifg
const IMGURL = '//repo.bfw.wiki/bfwrepo/image/5fefd67283919.png';

$.ShaderChunk.my_map_fragment = `
#ifdef USE_MAP
    float t = t * 0.0001;
    vec2 uv = vUv * vec2(2.0);
    vec4 o = texture2D(map,.........完整代码请登录后点击上方下载按钮下载查看

网友评论0