Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                
              
            
!

CSS

              
                
              
            
!

JS

              
                //this code is in need of clean up and commenting.
let warpR = [];
let warpG = [];
let warpB = [];
let weftR = [];
let weftG = [];
let weftB = [];
let rnd = 1
function setup() {
  createCanvas(windowWidth, windowHeight);
  noStroke();
}
function draw() {
  background(0)
  setColor()
  for (let i=0;i<40;i++){
   fill(warpR[i],warpG[i],warpB[i])
    rect(5+25*i,0,20,width)
  }//warp
  t = frameCount*5;
  for(let k=0;k<30;k++){
    fill(weftR[k],weftG[k],weftB[k])
    p = 0
      if (k%2 == 0){
        p = 30
      }
    rect(0,5+k*25,t,20)//weft
     for(let i=0;i<40;i++){
      fill(warpR[i],warpG[i],warpB[i])
      p = 5
      if (k%2 ==0 && i%2!=0){
        rect(p+25*i,p+k*25,20,20)
        if(k>0&&i>0)
        fill(warpR[i-1],warpG[i-1],warpB[i-1])
        rect(p+25*i-25,p+(k-1)*25,20,20)
      }
    }
  }
  if (frameCount*3 > width){
    frameCount = 0;
    rnd = rnd +1;
    if (rnd == 11){
      rnd = 1;
    }
  }
}

function setColor(){
  round1()
  round2()
  round3()
  round4()
  round5()
  round6()
  round7()
  round8()
  round9()
  round10()
  round11()
}

function round1(){
  if (rnd == 1){
    for (let i=0;i<40;i++){
      warpR[i]=255
      warpG[i]=255
      warpB[i]=255
      weftR[i]=200
      weftG[i]=200
      weftB[i]=255
      if (i%2 ==0){
        weftR[i]=100
        weftG[i]=200
        weftB[i]=255
      }
    }
  }
}

function round2(){
  if (rnd == 2){
    for (let i=0;i<40;i++){
      warpR[i]=7*i
      warpG[i]=255-15*i
      warpB[i]=255-10*i
      weftR[i]=15*i
      weftG[i]=255-20*i
      weftB[i]=255-15*i
    }
  }
}
function round3(){
  if (rnd == 3){
    for (let i=0;i<40;i++){
      warpR[i]=255
      warpG[i]=255
      warpB[i]=255
      weftR[i]=240
      weftG[i]=240
      weftB[i]=245
      if (i%3 ==0){
        warpR[i]=250
        warpG[i]=200
        warpB[i]=200
      }
      if(i%3 ==0){
        weftR[i]=230
        weftG[i]=180
        weftB[i]=180
      }
    }
  }
}
function round4(){
  if (rnd == 4){
    for (let i=0;i<40;i=i+3){
      warpR[i]=10
      warpG[i]=110
      warpB[i]=160
      warpR[i+1]=30
      warpG[i+1]=150
      warpB[i+1]=200
      warpR[i+2]=50
      warpG[i+2]=200
      warpB[i+2]=255
      weftR[i]=00
      weftG[i]=100
      weftB[i]=150
      weftR[i+1]=20
      weftG[i+1]=140
      weftB[i+1]=190
      weftR[i+2]=40
      weftG[i+2]=180
      weftB[i+2]=240
    }
  }
}
function round5(){
  if (rnd == 4){
    for (let i=0;i<40;i=i+4){
      warpR[i]=10
      warpG[i]=110
      warpB[i]=160
      warpR[i+1]=255
      warpG[i+1]=255
      warpB[i+1]=255
      warpR[i+2]=100
      warpG[i+2]=200
      warpB[i+2]=255
      warpR[i+3]=10
      warpG[i+3]=110
      warpB[i+3]=160
      weftR[i]=00
      weftG[i]=100
      weftB[i]=150
      weftR[i+1]=240
      weftG[i+1]=240
      weftB[i+1]=240
      weftR[i+2]=40
      weftG[i+2]=180
      weftB[i+2]=240
      weftR[i+3]=40
      weftG[i+3]=180
      weftB[i+3]=240
    }
  }
}
function round6(){
  if (rnd == 6){
    for (let i=0;i<40;i++){
      warpR[i]=200
      warpG[i]=200
      warpB[i]=200
      weftR[i]=210
      weftG[i]=210
      weftB[i]=210
      if (i%4 ==0){
        warpR[i]=200
        warpG[i]=100
        warpB[i]=100
        weftR[i]=210
        weftG[i]=110
        weftB[i]=110
      }
    }
  }
}
function round7(){
  if (rnd == 7){
    for (let i=0;i<40;i++){
      warpR[i]=200
      warpG[i]=200
      warpB[i]=200
      weftR[i]=210
      weftG[i]=210
      weftB[i]=210
      if (i%5 ==0){
        warpR[i]=200
        warpG[i]=100
        warpB[i]=100
        weftR[i]=210
        weftG[i]=110
        weftB[i]=110
      }
    }
  }
}
function round8(){
  if (rnd == 8){
    for (let i=0;i<40;i++){
      warpR[i]=200
      warpG[i]=200
      warpB[i]=200
      weftR[i]=210
      weftG[i]=210
      weftB[i]=210
      if (i%6 ==0||i%2==0){
        warpR[i]=200
        warpG[i]=100
        warpB[i]=100
        weftR[i]=210
        weftG[i]=110
        weftB[i]=110
      }
      if (i%5 ==0 || i%4==0){
        warpR[i]=100
        warpG[i]=100
        warpB[i]=100
        weftR[i]=110
        weftG[i]=110
        weftB[i]=110
      }
    }
  }
}
function round9(){
  if (rnd == 9){
    for (let i=0;i<40;i++){
      warpR[i]=i*3
      warpG[i]=i*4
      warpB[i]=i*5
      weftR[i]=i*3.1
      weftG[i]=i*4.1
      weftB[i]=i*5.1
      if (i%2 ==0){
        warpR[i]=i*3
        warpG[i]=i*2
        warpB[i]=i*1.5
        weftR[i]=i*3.1
        weftG[i]=i*2.1
        weftB[i]=i*1.6
      }
    }
  }
}
function round10(){
  if (rnd == 10){
    for (let i=0;i<40;i++){
      warpR[i]=40
      warpG[i]=80
      warpB[i]=40
      weftR[i]=50
      weftG[i]=90
      weftB[i]=50
      if (i>0){
        warpR[i]=40 + 30*(i%5)
        warpG[i]=80 + 30*(i%5)
        warpB[i]=40 + 30*(i%5)
        weftR[i]=50 + 30*(i%5)
        weftG[i]=90 + 30*(i%5)
        weftB[i]=50 + 30*(i%5)
      }
    }
  }
}
function round11(){
  if (rnd == 11){
    for (let i=0;i<40;i++){
      warpR[i]=100
      warpG[i]=50
      warpB[i]=40
      weftR[i]=110
      weftG[i]=60
      weftB[i]=50
      if (i>0){
        warpR[i]=100 + 30*(i%3)
        warpG[i]=50 + 30*(i%3)
        warpB[i]=40 + 30*(i%3)
        weftR[i]=110 + 30*(i%3)
        weftG[i]=60 + 30*(i%3)
        weftB[i]=50 + 30*(i%3)
      }
    }
  }
}
              
            
!
999px

Console