simplex-noise实现逼真毛发动画效果代码

代码语言:html

所属分类:动画

代码描述:simplex-noise实现逼真毛发动画效果代码

代码标签: simplex-noise 逼真 毛发 动画

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

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

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


  
  
  
  
<style>
html,
body {
  margin: 0;
  padding: 0;
}

body {
  width: 100vw;
  height: 100vh;
  
  display: flex;
  justify-content: center;
  align-items: center;
  
  background: #000;
}
</style>


  
</head>

<body>
  <canvas id="canvas"></canvas>

  
      <script  type="module">
import { createNoise3D } from '//repo.bfw.wiki/bfwrepo/js/module/simplex-noise.js';

const DIMENSION = 400;
const MID = DIMENSION * 0.5;
const R = MID * 0.95;
const NOISE_SCALE = 0.001;
const TAU = Math.PI * 2;

const ab = (vec1, vec2) => Math.atan2(vec2.y - vec1.y, vec2.x - vec1.x);
const rand = (min, max) => Math.random() * (max - min) + min;
const ctx = document.querySelector('#canvas').getContext('2d');

const noise3D = createNoise3D();

ctx.canvas.width = ctx.canvas.h.........完整代码请登录后点击上方下载按钮下载查看

网友评论0