three实现模拟气体加热运动动画效果代码

代码语言:html

所属分类:三维

代码描述:three实现模拟气体加热运动动画效果代码

代码标签: 气体 加热 运动 动画 效果

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


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

<head>

  <meta charset="UTF-8">
  
<link rel="apple-touch-icon" type="image/png" href="https://cpwebassets.codepen.io/assets/favicon/apple-touch-icon-5ae1a0698dcc2402e9712f7d01ed509a57814f994c660df9f7a952f3060705ee.png" />
<meta name="apple-mobile-web-app-title" content="CodePen">

<link rel="shortcut icon" type="image/x-icon" href="https://cpwebassets.codepen.io/assets/favicon/favicon-aec34940fbc1a6e787974dcd360f2c6b63348d4b1f4e06c77743096d55480f33.ico" />

<link rel="mask-icon" type="" href="https://cpwebassets.codepen.io/assets/favicon/logo-pin-8f3771b1072e3c38bd662872f6b673a722f4b3ca2421637d5596661b4e2132cc.svg" color="#111" />


  <title>CodePen - Heated Gas Sim</title>
  
  
  
  
<style>
canvas {
  background-color: #a13d4c;
  display: block;
  place-items: center;
  height: 100%;
  width: 100%;
}
</style>

  <script>
  window.console = window.console || function(t) {};
</script>

  
  
  <script>
  if (document.location.search.match(/type=embed/gi)) {
    window.parent.postMessage("resize", "*");
  }
</script>


</head>

<body>
  <canvas id="canvas"></canvas>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/three.123.js"></script>
<script src='//repo.bfw.wiki/bfwrepo/js/OrbitControls.js'></script>
<script src='//repo.bfw.wiki/bfwrepo/js/dat.gui.min.js'></script>
      <script >
//I don't know how to code fire yet so I used a spinning texture. Have a laugh :P 

const scene = new THREE.Scene();

const url = '//repo.bfw.wiki/bfwrepo/image/6008e42eb0307.png';

const spheres = [];

//Camera
const camera = new THREE.PerspectiveCamera(
45,
window.innerWidth / window.innerHeight,
0.1,
1000);

camera.position.z = 30;

//Renderer
const canvas = document.getElementById("canvas");
const renderer = new THREE.WebGLRenderer({
  canvas,
  alpha: true,
  antialias: true });

renderer.setSize(window.innerWidth, window.innerHeight);
document.body.appendChild(renderer.domElement);

//Lighting
const ambientLight = new THREE.AmbientLight(0xd1d1b6, 1.5);
renderer.shadowMap.enabled = true;
renderer.shadowMap.type = THREE.BasicShadowMap;
ambientLight.castShadows = true;
scene.add(ambientLight);

//Object Controls
const controls = new THREE.OrbitControls(camera, renderer.domElement);
controls.autoRotate = false;
controls.update();

//Textures
const textureCu.........完整代码请登录后点击上方下载按钮下载查看

网友评论0