Public
Edited
Feb 2, 2023
1 star
Insert cell
Insert cell
Insert cell
p5((s) => {
let x, y, itr, wv, wv2;
let c1, c2, c3;
// Color
c1 = getColor();
c2 = getColor();
let bg = 255;

s.setup = function () {
s.createCanvas(W, H);
s.noStroke();
s.background(bg);
itr = 0;
x = 0;
y = W * 0.5;
wv = s.random(1);
wv2 = s.random(1);
};
s.draw = function () {
for (let i = 0; i < 150; i++) {
s.push();
x = s.cos(s.frameCount * 0.2);
y = s.sin(s.frameCount * 0.2);
s.fill(0);
s.translate(0, H * 0.5);
s.ellipse(
itr,
y * 350 * s.sin(i * wv * 0.2 - s.cos(s.frameCount * wv)),
1,
1
);
s.pop();
itr++;
if (itr > W) {
itr = 0;
}
}
};
})
Insert cell
W = form.width
Insert cell
H = form.height
Insert cell
Insert cell
Insert cell
Insert cell
import { p5 } from "@tmcw/p5"
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more