p5实现电闪雷鸣狂风暴雨动画效果代码
代码语言:html
所属分类:动画
代码描述:p5实现电闪雷鸣狂风暴雨动画效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
</head>
<body>
<div id="controls"></div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.js"></script>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/p5.sound.min.js"></script>
<script >
class Droplet{
constructor(){
this.x = random(-width/2, width*1.5);
this.y = -20;
this.z = random();
let a = PI/2 + random(0, .1) + .1;
this.dx = cos(a)*(this.z*5 + 1);
this.dy = sin(a)*(this.z*5 + 1);
this.splash = false;
this.dead = false;
this.amt = 0;
}
update(){
if (!this.splash){
this.prevX = this.x;
.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0