Skip to content

Instantly share code, notes, and snippets.

@jonesfish
Last active October 15, 2015 15:07
Show Gist options
  • Select an option

  • Save jonesfish/13d6894dc66a040ed112 to your computer and use it in GitHub Desktop.

Select an option

Save jonesfish/13d6894dc66a040ed112 to your computer and use it in GitHub Desktop.

Revisions

  1. jonesfish revised this gist Oct 15, 2015. 1 changed file with 8 additions and 8 deletions.
    16 changes: 8 additions & 8 deletions loopvsdraw2.pde
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,16 @@
    int x = 0;

    void setup(){
    size(400,300);
    ellipseMode(CORNER);
    colorMode(HSB);
    }

    // repeat all the time --> refresh the screen continuously
    void draw(){
    background(0);
    // repeat within a single frame
    while ( x < mouseX){
    ellipse(x,100,20,20);
    x += 20;
    }
    float spacing = 20;
    for (float x=0; x < mouseX; x+=spacing){
    float hue = x/width * 255;
    noStroke();
    fill(hue, 255, 255);
    rect(x,0,spacing,height);
    }
    }
  2. jonesfish created this gist Oct 15, 2015.
    16 changes: 16 additions & 0 deletions loopvsdraw2.pde
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    int x = 0;

    void setup(){
    size(400,300);
    ellipseMode(CORNER);
    }

    // repeat all the time --> refresh the screen continuously
    void draw(){
    background(0);
    // repeat within a single frame
    while ( x < mouseX){
    ellipse(x,100,20,20);
    x += 20;
    }
    }