Tut­o­r­i­a­l 2 - lemon table cloth

by Lisa Deng
  • Show Sketch
/** @peep sketchcode */
 
//Based on examples of "Conditional 1" available in processing
 
size(400,400);
background(50,100,180);
int x;
int a;
int c;
 
//creating grid pattern
for(a=10; a<width; a+=10){
  for (c=10; c<height; c+=10)
  {
  fill (0,244,0);
  noStroke();
  rect(a,c,1,1);}
};
 
//creating background
  fill(50,100,180);
  noStroke();
  rectMode(CENTER);
  rect(width/2,height/2,400,50); 
 
 
 
//creating lemon pattern
for(x=10; x <width; x+=15)
  if (x%20 == 0){
    stroke (0);
    fill(255,255,30);
    int b=height/2-20;
    int t=height/2+20;
    strokeWeight(2);
    stroke(30,150,100);
    bezier (x,b,x-10,b+10,x-10,t-10,x,t);
    bezier (x,b,x+10,b+10,x+10,t-10,x,t);}
  else {
    int b=height/2-15;
    int t=height/2+15;
    stroke (0,200,0);
    line (x,b,x,t);}
 
//creating boxes upper
for(x=5; x <width; x+=15)
  if (x%10 == 0){
    fill(0,255,0,90);
    noStroke();
    rectMode(CORNER);
    rect(x,height/4,10,10,2);
  }
 
//creating boxes lower
for(x=5; x <width; x+=15)
  if (x%10 == 0){
    fill(0,255,0,90);
    noStroke();
    rectMode(CORNER);
    rect(x,height/4*3,10,10,2);
  }

Comments

    Lisa Deng about a year ago

    use of "for statements etc"

    Last Updated: 9-Mar-2016 12:59 PM