Ring with CurveVertex
in
Programming Questions
•
11 months ago
Hello there.
In the following code I use a for loop to create a shape with curveVertex.
How can I change the following code to create instead of straight lines a ring structure (i.e.
concentric circles)?
Many thanks!
- int strength = 200;
- int ystep = 5;
- int xstep = 20;
- void setup() {
- size(600, 400);
- smooth();
- background(0);
- frameRate(30);
- }
- void draw() {
- background(0);
- strokeWeight(0.5);
- translate(0, height/4);
- for (int y = 0; y < strength; y += ystep) {
- beginShape();
- for (int x = 0; x <= (width-xstep) + xstep; x += xstep) {
- stroke(255);
- noFill();
- curveVertex(x, y);
- }
- endShape();
- }
- }
1