<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>rock</title>
<script src="Processing.js"></script>
</head>
<body>
<h1></h1>
<script type="text/processing">
int SEGMENTS = 30;//goucheng yvan xianduan shuliang
float ANGLE_PER_SEGMENT = TWO_PI / SEGMENTS;
int INNER_RADIUS = 50;//da xiao?
float RADIUS_VARIATION = 150;
void setup() {
size(850, 1500);
smooth();
background(0);
stroke(0);
}
PVector PointForIndex(int i) {
float angle = ANGLE_PER_SEGMENT * i;//jisuan xianduan diyige dian
float cosAngle = cos(angle);
float sinAngle = sin(angle);
float noiseScale = 0.5;//xianduan bianhua jiaodu 0.5 shufu
float time = frameCount * 0;//bisnhusn pinlv 0.01 shufu
float noiseValue = noise(noiseScale * cosAngle + noiseScale,
noiseScale * sinAngle + noiseScale,
time);
float radius = INNER_RADIUS + (RADIUS_VARIATION * noiseValue);//yvan banjing
return new PVector(radius * cosAngle, radius * sinAngle);
}
void draw() {
background(255);
translate(width / 2, height / 2);
for (int i = 0; i < SEGMENTS; ++i) {
PVector p0 = PointForIndex(i);
PVector p1 = PointForIndex(i + 1);
line(p0.x, p0.y, p1.x, p1.y);
}
}
</script>
<canvas></canvas>
</body
console