Public
Edited
Oct 21, 2024
Insert cell
Insert cell
p5(sketch => {
let system;
sketch.setup = function() {
sketch.createCanvas(width, 700);
};
sketch.draw = function() {
sketch.translate(sketch.width / 2, sketch.height / 2);
sketch.background(200,90, 200);
let n = 200;
let angulo = sketch.TWO_PI/n;
let raio = 0.2 * sketch.width;
sketch.fill(0,160,200);
sketch.beginShape();

for(let i=0; i<n; i++){
let x = (raio + (40*sketch.cos(i*angulo*5))) * sketch.cos(i*angulo); //mudar o *10 altera a qtd de lados
let y = (raio + (40*sketch.cos(i*angulo*5))) * sketch.sin(i*angulo); // mudar o 20* altera o angulo
sketch.vertex(x,y);
}

sketch.endShape(sketch.CLOSE);
}
})
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