我在注视你眼睛跟随鼠标交互效果

代码语言:html

所属分类:动画

代码描述:我在注视你眼睛跟随鼠标交互效果

代码标签: 眼睛 跟随 鼠标 交互 效果

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


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
body {
  overflow: hidden;
  margin: 0;
  height: 100vh;
  display: flex;
}

canvas {
  margin: auto;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
</style>

</head>
<body translate="no">
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/p5.js"></script>
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/gsap.3.2.6.js"></script>
<script >
console.clear();

let eyes = [];
let col;
let cell = window.innerWidth < 700 ? 30 : 50;

function setup () {
  const size = min(windowWidth, windowHeight) * 0.95;
  createCanvas(size, size);
  
  const cols = floor(width / cell);
  const offset = (width - (cols * cell)) / 2;
  
  for (let x = 0; x < cols; x++) {
    for (let y = 0; y < cols; y++) {
      eyes.push(new Eye(x, y, offset));
    }
  }
}

function windowResized () {
  cell = window.innerWidth < 700 ? 30 : 50;
  const size = min(w.........完整代码请登录后点击上方下载按钮下载查看

网友评论0