How do i flip an arc to other way?

this is my code, i want the arc to be facing upside, not upside down

void setup(){ size(800,600); } void draw() {

fill(0);

arc(400, 200, 80, 80, 0, PI); }

Tagged:

Answers

  • If you want the arc drawn differently, you will need to pass it different parameters! Like so:

    void setup() { 
      size(800, 600);
    } 
    
    void draw() {
      fill(0);
      arc(400, 200, 80, 80, PI, TWO_PI);
    }
    
  • edited April 2017

    @lisa_weber -- Using different parameters is the best way. Another option if you want to flip everything you draw is to use scale() -- scale(-1,1) to flip horizontally, or scale(1,-1) to flip vertically.

    However, this flips your whole coordinate system -- so if you are about to draw things with an offset (like 400,200) then they often flip right off the edge of screen. Instead, use translate() first to move to your 0,0 drawing location to the middle of the screen, optionally flip with scale(), then draw your flipped-or-unflipped object at 0,0.

    void setup() { 
      size(800, 600);
    }
    void draw() {
      background(255);
      fill(0);
      translate(width/2, height/2);
      if(keyPressed){
        scale(1, -1);
      }
      arc(0, 0, 80, 80, 0, PI);
    }
    
Sign In or Register to comment.