แสดงบทความที่มีป้ายกำกับ Lab1 แสดงบทความทั้งหมด
แสดงบทความที่มีป้ายกำกับ Lab1 แสดงบทความทั้งหมด

วันอาทิตย์ที่ 23 สิงหาคม พ.ศ. 2558

Lab1-Spyair(Move Up and Down)

void setup(){
  int up = 250;
  int down = 120;
  size(400,400);
  background(0);
  strokeWeight(12);
  stroke(#FFFFFF);
  noFill();

  /////Logo/////
  ellipse(200,130+down,220,220);
  line(95,100+down,260,40+down);
  line(205,65+down,280,200+down);
  line(205,65+down,180,235+down);
  line(95,100+down,260,165+down);
  line(130,210+down,260,165+down);

  ///// "SPYAIR" /////
  textAlign(CENTER);
  textSize(100);
  text("SPYAIR",200,350-up);
}


Lab1-Gintama(Resize)

void setup(){
  int resize = 40;
  int space = 200;
  size(500,600);
  background(100);
  strokeWeight(5);

  /////Book/////
  rect(50,50,400,500);

  /////Eye/////
  ellipse(150,200,100-resize,100-resize); //Left
  ellipse(150+space,200,100-resize,100-resize); //Right

  /////In Eye/////
  fill(0);
  ellipse(150,200,50-resize,50-resize); //Left
  ellipse(150+space,200,50-resize,50-resize); //Right

  /////Eyelashes/////
  line(110,140,120,160); //Left1
  line(150,130,150,150); //Left2
  line(190,140,180,160); //left3
  line(110+space,140,120+space,160); //Right1
  line(150+space,130,150+space,150); //Right2
  line(190+space,140,180+space,160); //Right3

  /////Mouth/////
  fill(#FFFF00);
  ellipse(250,320,250-resize,80-resize);
  line(140+resize,320,160-resize+space,320);

  ///// "ELIZABETH" /////
  fill(0);
  textAlign(CENTER);
  textSize(20);
  text("ELIZABETH",250,80);

  ///// "GINTAMA" /////
  fill(50);
  textAlign(CENTER);
  textSize(70-resize);
  text("GINTAMA",250,500);
}


Lab1-Jurassic Brown(Move Down)

void setup(){
  int down = 60;
  size(600,400);
  background(0);

  /////Background Logo/////
  noStroke();
  fill(#FFFF00);
  ellipse(300,200,350,350);
  rect(50,200+down,500,120);

  /////Red Circle/////
  stroke(0);
  strokeWeight(5);
  fill(#FF0000);
  ellipse(300,200,320,320);

  /////Ear/////
  strokeWeight(3);
  fill(#4E3028);
  arc(250,130+down,50,60,HALF_PI+QUARTER_PI,PI+PI,OPEN); //Left
  arc(350,130+down,50,60,-PI,QUARTER_PI,OPEN); //Right

  /////InEar/////
  noStroke();
  fill(#281914);
  arc(250,130+down,30,45,HALF_PI+QUARTER_PI,PI+PI,OPEN); //Left
  arc(350,130+down,30,45,-PI,QUARTER_PI,OPEN); //Right

  /////Head/////
  stroke(0);
  strokeWeight(3);
  fill(#4E3028);
  arc(300,210+down,200,200,PI,PI+PI);

  /////Face/////
  noStroke();
  fill(#FFFFCC);
  ellipse(300,200+down,50,70); //Nose Background
  fill(0);
  ellipse(290,160+down,10,10); //Left Eye
  ellipse(310,160+down,10,10); //Right Eye
  stroke(0);
  strokeWeight(3);
  triangle(300,185+down,295,175+down,305,175+down); //Nose

  ///Mouth///
  line(300,180+down,300,200+down);
  line(300,200+down,280,220+down);
  line(300,200+down,320,220+down);

  /////Black label/////
  fill(0);
  rect(60,210+down,480,100);

  ///// "JURASSIC BROWN" /////
  fill(#FFFF00);
  textSize(50);
  text("JURASSIC BROWN",75,280+down);
}


Lab1-Circle

void setup(){
 float dia = 100; //Diameter
 float rad = dia/2; //Radius
 float cir; //Circumference
 float area; //Area

 /////Calculate/////
 cir = 2*PI*rad;
 area = PI*rad*rad;

 /////Show Value/////
 size(600,250);
 background(#FFCCCC);
 fill(#FF0000);
 textSize(30);
 text("Diameter = "+dia,25,50);
 text("Radius = "+rad,25,100);
 text("Circumference = " +cir,25,150);
 text("Area = "+area,25,200);
}


Lab1-BMI

void setup(){
 float high = 173; //Height in centimeters
 float weight = 60; //Weight in kilograms
 float highM = high/100; //Height in meters
 float BMI; //Body Mass Index

 /////Calculate/////
 BMI = weight/(highM*highM);

 /////Show Value/////
 size(450,200);
 background(#99FFFF);
 textSize(30);
 fill(#008B00);
 text("Weight = "+weight+" kg",25,50);
 text("Height = "+high+" cm",25,100);
 fill(#FF0000);
 text("BMI = "+BMI,25,150);
}


วันศุกร์ที่ 21 สิงหาคม พ.ศ. 2558

Lab1-Positive

void setup(){
 int highX = 100; //ความสูงของสี่เหลี่ยมในแนวแกน X
 int widthX = 300; //ความยาวของสี่เหลี่ยมในแนวแกน X
 int highY = 300; //ความสูงของสี่เหลี่ยมในแนวแกน Y
 int widthY = 100; //ความยาวของสี่เหลี่ยมในแนวแกน Y
 int posX = 200; //ตำแหน่งแกน X
 int posY = 50; //ตำแหน่งแกน Y

 size(500,500);
 background(#FFFFFF);

/////POSITIVE/////
noStroke();
 fill(#FF0000);
 rect(posX,posY,highX,widthX);
 rect(posX-100,posY+100,highY,widthY);

///// "POSITIVE" /////
 textAlign(CENTER);
 textSize(60);
 fill(#008B00);
 text("POSITIVE",posX+50,posY+400);
}


วันจันทร์ที่ 17 สิงหาคม พ.ศ. 2558

Lab1-BATTERY

void setup(){
    int space = 65;
    size(400,600);
    background(0);

    /////ตัวแบตเตอรี่/////
    noFill();
    stroke(#FFFFFF)
    strokeWeight(5);
    rect(100,100,200,400);
    fill(#FFFFFF)
    rect(170,80,60,20);
   
    /////ปริมาณแบตเตอรี่ที่คงอยู่/////
    strokeWeight(2);
    //โซนสีเขียว//
    fill(#008B00);
    rect(110,110,180,60);
    rect(110,110+space,180,60);
    rect(110,110+space*2,180,60);
     //โซนสีเหลือง//
    fill(#FFCC33);
    rect(110,110+space*3,180,60);
    rect(110,110+space*4,180,60);
    //โซนสีแดง//
    fill(#FF0000);
    rect(110,110+space*5,180,60);
   
    /////เปอร์เซ็นต์แสดงปริมาณแบตเตอรี่/////
    textAlign(CENTER);
    textSize(40);
    fill(#FFFFFF);
    text("100%",200,155);
    text("80%",200,155+space);
    text("60%",200,155+space*2);
    text("40%",200,155+space*3);
    text("20%",200,155+space*4);
    text("0%",200,155+space*5);
 
    ///// "BATTERY" /////
    textSize(60);
    fill(100);
    text("BATTERY",200,580);
}