碎片粒子规则旋转效果

代码语言:html

所属分类:粒子

代码描述:碎片粒子规则旋转效果

代码标签: 旋转 效果

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

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

<style>
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
body {
  overflow: hidden;
  height: 100%;
}
</style>

</head>
<body translate="no">
<script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/p5.js"></script>
<script >
levels = 6;

speed = 1; // rotate this much degrees per frame
framesPerSecond = 30;

class Shape {
	constructor(size, angle, level, move = true) {
		this.angle = angle;
		this.size = size;
		this.level = level;
		this.move = move;
		this.generateChildren();
	}

	generateChildren() {
		if (this.level <= 0) return;
		this.children = [];
		const step = 360 / this.level;
		for (let i = 0; i < this.level; i++) {
			const ring = new Shape(this.size / 2, step .........完整代码请登录后点击上方下载按钮下载查看

网友评论0