xxxxxxxxxx
let yoff = 0.0; // 柏林噪声的第二维度
let groundGraphics
let particles=[]
let shields=[]
let suns=[]
let shield, sun, dim
let maxSpeed= 2
function setup() {
background(220);
createCanvas(windowWidth, windowHeight);
groundGraphics = createGraphics(width,height)
for (let i=0;i<100000;i++){
groundGraphics.push()
groundGraphics.fill(221)
groundGraphics.stroke(221)
groundGraphics.circle(random(width),random(height),0.1)
tint(200,225)
groundGraphics.pop()
}
}
function draw() {
image(groundGraphics,0,0)
fill(10,random(10,255),255);
stroke(0);
frameRate(50)
// 我们将从波点中绘制一个多边形
beginShape();
let xoff = 0; // 选项 1: 2D 噪声
// let xoff = yoff; // 选项 2: 1D 噪声
// 迭代所有水平像素
for (let x = 0; x <= width; x += 10) {
// 根据noise() 和 map() 函数计算一个 y 值
// 选项 1: 2D 噪声
let y = map(noise(xoff, yoff), 0, 1, 200, 1050);
// 选项 2: 1D 噪声
// let y = map(noise(xoff), 0, 1, 200,300);
// 设置顶点
vertex(x, y);
// 增加噪声的 x 维度
xoff += 0.05;
}
// 增加噪声的 y 维度
yoff += 0.01;
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
push()
//fill(255,random(0,155),0);
fill("rgb(226,66,47)");
noStroke();
let r= random(10,300)
ellipse(100, 200,r,r);
//circle(100,200,300);
pop()
//noLoop()
}