• fullscreen
  • BARCODES.pde
  • float x = 0;
    
    void setup() {
      size (500,500);
      background(0);
     stroke(255);
    }
    
    void change_color() {
        
       //change line color to purple 
    if(random(200) > 100) {
      println("PURPLE");
      stroke(255,0,255);
    } else{
      //change to blue
      stroke(0,0,255);
    }
    }
    
    
    
    
    
    void draw() {
     //draw white line
      line(x, 200, x, 100);
    
    //attempt to change color
    
    if(random(100) > 55) {
      println("TRUE");
      change_color();
    }else{
      println("FALSE");
      stroke(255);
    }
      //movement
      x = x + 1;
     
      //repeat
      if(x>width) {
        x = 0;
       
      
    }
    
    
    }
    

    code

    tweaks (0)

    about this sketch

    This sketch is running as Java applet, exported from Processing.

    license

    advertisement

    Andy Brent

    BARCODES

    Add to Faves Me Likey@!
    You must login/register to add this sketch to your favorites.

    A barcode, modified from FunProgramming.

    You need to login/register to comment.