Project 5: Wallpaper

sketch


//i was inspired by beaches and shells that found there cause i am from Socal

var wValue= []; 
var e = 100;
var j = e;

function setup() {
  var canvas = createCanvas(600, 220);  
 
  for (let x = 0; x <= width + 990; x += e) {
    for (let y = 0; y <= height + 200; y += j) {

      var object = {};
      
      //colors
      object.r = random(0, 255);
      object.g = random(0,255);
      object.b = random(0, 255);
      //sizes
      object.s = random(40, 50);
      
            wValue.push(object);
    }
  }
}

function draw() {
  pattern();
}

function pattern() {

  background(0, 0, 0);


  var counter = 0; 
  for (let x = 0; x <= width + 990; x += e) {
    for (let y = 0; y <= height + 200; y += j) {

      //colors
      let val = wValue[counter];
      counter++; // count to next object for next loop
      
      let r = val.r;
      let g = val.g;
      let b = val.b

      //sizes
      let s = val.s;

      push();
      scale(0.4);
      translate(x, y + 80);
      stroke(r, g, b);
      strokeWeight(5);
      noFill();
      for (let i = 0; i < 10; i++) {
        fill(255);
        ellipse(9, 20, s, s); //shell
        rotate(PI / 4);
      }
      pop();
      
       
    }
  }
}

Leave a Reply