function setup() {
createCanvas(800, 500);
noStroke(); // Remove the outline around the circles
}
function draw() {
background(220);
for (let x=20;x<width;x+=40) {
for (let y=20;y<height;y+=40) {
let f = (y < height / 2) ? map(y, 20, height / 2, 20, 50) : map(y, height / 2, height, 50, 20);
let r = map(x, 0, width, 100, 255)
let g = map(y, 0, height, 100, 200)
let b = map(f, 20, 50, 200, 255)
fill(r,g,b,150)
let n = random(-5, 5)
let m = random(-5, 5)
circle(x+n,y+m,f)
}
}
}
let r;
let g;
let haha=0;
function setup() {
createCanvas(800, 500);
}
function draw() {
background(10);
noStroke();
translate(width / 2, height / 2);
rotate(haha);
haha+=0.035;
translate(-width / 2, -height / 2);
for (let x = 20-300; x < width+300; x += 40) {
for (let y = 20-280; y < height / 2; y += 40) {
let f = map(y, 50, 500, 20, 50);
r = map(x,0,width,248,253);
g = map(y,0,height,180,186);
fill(r,g,30);
circle(x + random(-1, 1), y + random(-1, 1), f);
}
for (let y = 260; y < height+300; y += 40) {
let f = map(y, 50, 500, 50, 20);
r = map(x,0,width,248,253);
g = map(y,0,height,180,186);
fill(r,g,30);
circle(x + random(-1, 1), y + random(-1, 1), f);
}
}
}
let r;
let g;
let haha=0;
let shaha=4;
function setup() {
createCanvas(800, 500);
}
function draw() {
background(10);
noStroke();
translate(0,haha);
haha+=shaha;
if(haha>200||haha<-200){
shaha = -shaha
}
for (let x = 20-300; x < width+300; x += 40) {
for (let y = 20-280; y < height / 2; y += 40) {
let f = map(y, 50, 500, 20, 50);
r = map(x,0,width,248,253);
g = map(y,0,height,180,186);
fill(r,g,30);
circle(x + random(-1, 1), y + random(-1, 1), f);
}
for (let y = 260; y < height+300; y += 40) {
let f = map(y, 50, 500, 50, 20);
r = map(x,0,width,248,253);
g = map(y,0,height,180,186);
fill(r,g,30);
circle(x + random(-1, 1), y + random(-1, 1), f);
}
}
}
let a = 0; // 初始角度
let r = 0; // 初始半径
let spiralSpeed = 0.1; // 螺旋的密集度
let r2 = 200; // 控制螺旋的最大半径
function setup() {
createCanvas(800, 500);
background(240);
}
function draw() {
background(0);
noStroke();
noLoop();
translate(width / 2, height / 2);
for (let i = 0; i < 50000; i++) {
let x = r * cos(a)
let y = r * sin(a)
// 显示圆点
let n = map(r, 0, r2, 5, 15)
fill(248,180,30);
ellipse(x, y, n, n);
x
a += spiralSpeed
r += 0.5
}
}
function setup() {
createCanvas(800, 500);
}
function draw() {
background(220);
stroke(220,93);
for (let x=20; x<1000; x+=40){
for (let y=20; y<1000; y+=40){
fill(103,122,99);
circle(x,y,80)
}
}
}
function setup() {
createCanvas(800, 500);
shakjdhasjkdfhushfcuibucie = random(1,2)
}
function draw() {
background(220);
stroke(10,90);
for (let x=0; x<1000; x+=40){
for (let y=0; y<1000; y+=40){
noFill();
rect(x,y,80)
}
}
stroke(220,93);
fill(103,122,99);
if (shakjdhasjkdfhushfcuibucie<1.5){
circle(mouseX,mouseY,80);
} else {
rect(mouseX-40,mouseY-40,80)
}
}
let r;
let g;
let b;
let haha = 0;
function setup() {
createCanvas(800, 500);
}
function draw() {
background(10);
noStroke();
translate(width / 2, height / 2)
rotate(haha)
haha += 0.05
translate(-width / 2, -height / 2)
for (let x = 20 - 300; x < width + 300; x += 40) {
for (let y = 20 - 280; y < height / 2; y += 40) {
let f = map(y, 50, 500, 20, 50)
r = map(x, 0, width, 200, 255)
g = map(y, 0, height, 100, 255)
b = map(y + x, 0, width + height, 100, 200)
circle(x + random(-5, 5), y + random(-5, 5), f + random(-10, 10));
}
for (let y = 260; y < height + 300; y += 40) {
let f = map(y, 50, 500, 50, 20)
r = map(x, 0, width, 200, 255)
g = map(y, 0, height, 100, 255)
b = map(y + x, 0, width + height, 100, 200)
fill(r, g, b, 150)
circle(x + random(-5, 5), y + random(-5, 5), f + random(-5, 5));
}
}
}
let w = 20;
let h;
let mySound;
let fft;
function preload() {
mySound = loadSound('Untitled.m4a');
}
function setup() {
createCanvas(400, 400);
mySound.play();
fft = new p5.FFT();
console.log(fft)
fill(random(199, 215), random(201, 219), random(130, 156));
noStroke();
}
function draw() {
background(220);
stroke(100,100);
noFill();
for (let i = 0; i < 1; i++){
let spectrum = fft.analyze();
let amplitude = spectrum[i] / 255;
h = map(amplitude, 0, 1, 0, height);
for(let x = w/2; x < width; x += w){
for (let y = w/2; y < h; y += w){
circle(x,y,w)
}
}
}
}