How to make a dotted or dashed ellipse in p5.js?

I have no code example to provide, this is just a general question on how to do this. Are there any external libraries that could help with this? Any code examples would be much appreciated!

I think you need to program your own ellipse and provide the dotted

pseudo code:


for (float angle = 0; angle < 360; angle += 20) {
  x=cos(radians(angle)) .... ; 
  y=cos(radians(angle)) .... ; 
  point(x,y);
}

Full Code

size(1200, 700);

background(0); 

stroke(255); 

for (int angle = 0; angle < 360; angle += 3) { 

  float x=cos(radians(angle))*200 + 300 ; 
  float y=sin(radians(angle))*200 + 300 ; 
  point(x, y);
}

1 Like