three实现三维照片布料被风吹动动画效果代码

代码语言:html

所属分类:三维

代码描述:three实现三维照片布料被风吹动动画效果代码,通过置换通道及alpha实现。

代码标签: three 三维 照片 布料 风吹 动画

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

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

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

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


  
</head>

<body>

<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/es-module-shims.1.6.2.js"></script>
<script type="importmap">
  {
    "imports": {      
      "three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/151/three.module.js",
      "three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/151/jsm/"
    }
  }
</script>
  
      <script type="module">
import * as THREE from 'three';
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';

// Milad Fakurian https://unsplash.com/photos/iFu2HILEng8
const disp_url = '//repo.bfw.wiki/bfwrepo/images/3d/disp.png';
const disp_tex = new THREE.TextureLoader().load(disp_url);
disp_tex.wrapS = THREE.MirroredRepeatWrapping;
disp_tex.wrapT = THREE.MirroredRepeatWrapping;
disp_tex.repeat.set(1, 1);

// Anton Darius https://unsplash.com/photos/jvR9ieZVG64
const alpha_url = '//repo.bfw.wiki/bfwrepo/images/3d/alpha.png';
const alpha_tex = new THREE.TextureLoader().load(alpha_url);
alpha_tex.wrapS = THREE.RepeatWrapping;
alpha_tex.wrapT = THREE.MirroredRepeatWrapping;
alpha_tex.repeat.set(0.1, 2);

// Anastasia Mihalkova https://unsplash.com/photos/rHWnVWrDUto
const image_url = '//repo.bfw.wiki/bfwrepo/image/629fe9ae4c888.png';
const image_tex = new THREE..........完整代码请登录后点击上方下载按钮下载查看

网友评论0