how to make this object quiet in line

edited March 2018 in Questions about Code

sorry void draw_car() { fill(0); stroke(0); rect(110, 269, 280, 10); rect(150, 255, 50,15); fill(179, 45, 0); ellipse(200,300,50,50); ellipse(145,300,50,50); ellipse(350,300,50,50); fill(0, 51, 204); stroke(0, 51, 204); rect(340, 220, 50,50); rect(260, 150, 80,120); stroke(0); fill(204, 217, 255); rect(280,170,30,80);

Answers

  • Post a runable example, formatted properly. Read the sticky thread to learn how to format your code.

    void setup(){
      size(600,600);
    }
    
    void draw(){
      background(128);
      draw_car();
    }
    
    void draw_car() { 
      fill(0); 
      stroke(0); 
      rect(110, 269, 280, 10); 
      rect(150, 255, 50, 15); 
      fill(179, 45, 0); 
      ellipse(200, 300, 50, 50); 
      ellipse(145, 300, 50, 50); 
      ellipse(350, 300, 50, 50); 
      fill(0, 51, 204); 
      stroke(0, 51, 204); 
      rect(340, 220, 50, 50); 
      rect(260, 150, 80, 120); 
      stroke(0); 
      fill(204, 217, 255); 
      rect(280, 170, 30, 80);
    }
    

    Now, tell us what you want to do. Give details. What does "quiet in line" even mean?

  • Answer ✓
    float x=-20; 
    
    void setup() {
      size(600, 600);
    }
    
    void draw() {
      background(128);
    
      translate(x, 0);
      draw_car();
      x+=1;
    }
    
    void draw_car() { 
      fill(0); 
      stroke(0); 
      rect(110, 269, 280, 10); 
      rect(150, 255, 50, 15); 
      fill(179, 45, 0); 
      ellipse(200, 300, 50, 50); 
      ellipse(145, 300, 50, 50); 
      ellipse(350, 300, 50, 50); 
      fill(0, 51, 204); 
      stroke(0, 51, 204); 
      rect(340, 220, 50, 50); 
      rect(260, 150, 80, 120); 
      stroke(0); 
      fill(204, 217, 255); 
      rect(280, 170, 30, 80);
    }
    
Sign In or Register to comment.