类鸟群Boid模拟动画效果
代码语言:html
所属分类:动画
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<style>
html, body {
margin: 0;
padding: 0;
}
canvas {
width: 100vw !important;
height: 52vw !important;
}
</style>
</head>
<body translate="no">
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/p5.js"></script>
<script>
var logo;
var vectors = [];
var logoW=703;
var logoH=221;
const flock = [];
class Boid {
constructor() {
this.position = createVector(random(width), random(height));
this.velocity = p5.Vector.random2D();
this.velocity.setMag(random(2, 4));
this.accelleration = creat.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0