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

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

Calculate circumference and area of a square from its diameter

void setup()
{
    size(500, 500);
    int w = 300; //กว้าง
    int l = 300; //ยาว
    float as; //Area of square
    float ls; //Line of square
    as= w*l; //สูตรหาพื้นที่
    ls= (2*w)+(2*l); //สูตรหาเส้นรอบรูป
    println("Value of as = "+as);
    println("Value of ls = "+ls);
    rect(105, 105, w, l);
    fill(0);
    textSize(15);
    text("Area = 90000", 150, 240);
    text("Circumference of square = 1200", 150, 270);
    }

วันอังคารที่ 18 สิงหาคม พ.ศ. 2558

My favorite song // Move.

void setup()
{
    int posX = -150;
    int posY = -30;
size(550, 550);
background(#99CCFF);
fill(#FFD700);
textSize(120);
text("P", 175+posX, 165+posY);
fill(#00FF00);
ellipse(300+posX, 120+posY, 90, 90); //วงกลมเขียว
fill(#FFA54F);
ellipse(300+posX, 120+posY, 60, 60); //วงกลมส้มอ่อน
fill(#4169E1);
textSize(18);
text("Cpr.E", 275+posX, 125+posY);
fill(#FF0066);
rect(210, 190, 15, 100); //แกนตัวที1
rect(182, 190, 75, 15); //หัวตัวที1
fill(#800080);
textSize(140);
text("A", 255, 290);
fill(#003300);
rect(210-posX, 320-posY, 15, 100); //แกนตัวที2
rect(182-posX, 320-posY, 75, 15); //หัวตัวที2
fill(#FF4500);
ellipse(310-posX, 375-posY, 110, 110); //วงกลมส้มเข้ม
fill(#FFFFFF);
ellipse(310-posX, 375-posY, 10, 60); //วงรีขาว
fill(#000000);
textSize(50);
text("Ting Wai Glahng Tahng", 10, 500);
    }

My favorite book // Mickey mouse.

void setup()
{
    int posY = -25;
    int Rad = 20;
size(500, 550);
background(#FFFFFF);
fill(#000000);
ellipse(250, 250, 300+Rad, 300+Rad); //วงกลมดำหน้า
ellipse(150, 100, 155+Rad, 155+Rad); //วงกลมดำหูขวา
ellipse(350, 100, 155+Rad, 155+Rad); //วงกลมดำหูซ้าย
fill(#FF0000);
ellipse(250, 280, 270+Rad, 250+Rad); //วงกลมแดงหน้า
fill(#FF0000);
arc(250, 250, 270+Rad, 250+Rad, PI/6, PI-PI/6); //ปากยิ้ม
arc(135, 290, 30+Rad, 50+Rad, PI/6, PI-PI/6); //มุมปากยิ้มขวา
arc(363, 290, 30+Rad, 50+Rad, PI/6, PI-PI/6); //มุมปากยิ้มซ้าย
fill(#FFFFFF);
ellipse(212, 250, 50+Rad, 80+Rad); //ตาขาวขวา
ellipse(282, 250, 50+Rad, 80+Rad); //ตาขาวซ้าย
fill(#000000);
ellipse(212, 260+posY, 30+Rad, 50+Rad); //ตาดำขวา
ellipse(282, 260+posY, 30+Rad, 50+Rad); //ตาดำซ้าย
ellipse(248, 310, 50+Rad, 50+Rad); //จมูก
textSize(50);
text("Mickey Mouse" , 100, 500);



    }

My favorite movie // Move.

void setup()
{
    int posX = -15;
size(550,550);
background(#555555);
stroke(153);
strokeWeight(4);
line(130+posX, 400, 530+posX, 400); //เส้นล่าง
line(30+posX, 300, 129+posX, 400); //เส้นหน้าเรือล่าง
line(530+posX, 300, 530+posX,400); //เส้นหลังเรือล่าง
line(30+posX, 300, 530+posX, 300); //เส้นบนเรือล่าง
line(205+posX, 200, 185+posX, 300); //เส้นปล่องเรือ1หน้า
line(255+posX, 200, 235+posX, 300); //เส้นปล่องเรือ1หลัง
line(205+posX, 200, 255+posX, 200); //เส้นปล่องเรือ1บน
line(202+posX, 220, 251+posX, 220); //เส้นปล่องเรือ1ล่าง
line(300+posX, 200, 280+posX, 300); //เส้นปล่องเรือ2หน้า
line(350+posX, 200, 330+posX, 300); //เส้นปล่องเรือ2หลัง
line(300+posX, 200, 350+posX, 200); //เส้นปล่องเรือ2บน
line(297+posX, 220, 346+posX, 220); //เส้นปล่องเรือ2ล่าง
line(395+posX, 200, 375+posX, 300); //เส้นปล่องเรือ3หน้า
line(445+posX, 200, 425+posX, 300); //เส้นปล่องเรือ3หลัง
line(395+posX, 200, 445+posX, 200); //เส้นปล่องเรือ3บน
line(392+posX, 220, 441+posX, 220); //เส้นปล่องเรือ3ล่าง
line(150+posX, 250, 90+posX, 300); //เส้นหน้าเรือบน
line(150+posX, 250, 490+posX, 250); //เส้นบนเรือบน
line(490+posX, 250, 490+posX, 300); //เส้นหลังเรือบน
line(105+posX, 375, 530+posX, 375); //เส้นกลางเรือ
ellipse(200+posX, 350, 25, 25); //หน้าต่าง1
ellipse(250+posX, 350, 25, 25); //หน้าต่าง2
ellipse(300+posX, 350, 25, 25); //หน้าต่าง3
ellipse(350+posX, 350, 25, 25); //หน้าต่าง4
ellipse(400+posX, 350, 25, 25); //หน้าต่าง5
ellipse(450+posX, 350, 25, 25); //หน้าต่าง6
ellipse(500+posX, 350, 25, 25); //หน้าต่าง7
ellipse(100+posX, 325, 10, 10); //วงกลมสมอ
arc(100+posX, 330, 20,40, PI/6, PI-PI/6); //โค้งสมอ
line(100+posX, 330, 100+posX, 355); //เส้นสมอ
textSize(100);
text("TITANIC" ,50 ,100);



}

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

Calculate body mass index (BMI)

void setup()
{
  size(500, 500);
  background(#FFFF00);
    float weigh = 58; //น้ำหนักหน่วยเป็นกิโลกรัม
    float heigh = 173e-2; //ส่วนสูงหน่วยเป็นเซนติเมตรหารด้วย 100
    float heighsq = heigh*heigh; //ส่วนสูงกำลังสอง
    float BMI;
    BMI = weigh/heighsq;
    println("Value of BMI = "+BMI);
    fill(#0000FF);
    textSize(20);
    text("Weight = 58 kg.", 150, 200);
    text("Height = 173 cm.", 150, 250);
    text("BMI = 19.37919743392696 kg/m^2", 150, 300);
}

Calculate circumference and area of a circle from its diameter

void setup()
{
    size(500, 500);
    int r = 300; //ค่ารัศมี
    float ac; //Area of circle
    float lc; //Area of line
    ac=PI*r*r; //สูตรหาพื้นที่
    lc=2*PI*r; //สูตรหาเส้นรอบรูป
    println("Value of ac = "+ac);
    println("Value of lc = "+lc);
    ellipse(250, 250, r, r);
    fill(0);
    textSize(11);
    text("Area = 282743.3388230814", 150, 240);
    text("Circumference of circle = 1884.9555921538758", 150, 270);
    }

Positive Sign

void setup()
{
    int startX = 210;
    int startY = 250;
    int sizepc = 85;
    int posX = 0;
    int posY = 0;
    size(500, 600);
    background(#00BFFF);
    noStroke();
    fill(#FF1493);
    rect(startX+posX, startY+posY, sizepc, sizepc); //กลาง
    rect(startX-75+posX, startY+posY, sizepc, sizepc); //ซ้าย
    rect(startX+75+posX, startY+posY, sizepc, sizepc); //ขวา
    rect(startX+posX, startY-75+posY, sizepc, sizepc); //บน
    rect(startX+posX, startY+75+posY, sizepc, sizepc); //ล่าง
    fill(#FF1493);
    textSize(50);
    text("Pink", startX-75+posX, startY+250+posY);
    fill(#FF0000);
    textSize(50);
    text("Cross", startX+40+posX, startY+250+posY);



   }

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

Bettery

void setup()
{
    int posX = 0;
    int posY = 0;
size(500,600);
int space = 60;
int startX = 125;
int startY = 100;
int wide = 250;
int high = 50;
fill(#FFFFFF);
rect(startX+posX, startY-25+posY, wide, high+350); //ตัวแบต
rect(startX+105+posX, startY-55+posY, wide-200, high-20); //หัวแบต
//เส้นเปอร์เซนต์ของแบต
fill(#008B00);
rect(startX+posX, startY+posY, wide, high);
fill(#FFFF00);
textSize(30);
text("100%", startX+85+posX, startY+40+posY);
fill(#008B00);
rect(startX+posX, startY+space+posY, wide, high);
fill(#FFFF00);
textSize(30);
text("80%", startX+105+posX, startY+100+posY);
fill(#008B00);
rect(startX+posX, startY+space*2+posY, wide, high);
fill(#FFFF00);
textSize(30);
text("60%", startX+105+posX, startY+160+posY);
fill(#008B00);
rect(startX+posX, startY+space*3+posY, wide, high);
fill(#FFFF00);
textSize(30);
text("40%", startX+105+posX, startY+220+posY);
fill(#008B00);
rect(startX+posX, startY+space*4+posY, wide, high);
fill(#FFFF00);
textSize(30);
text("20%", startX+105+posX, startY+280+posY);
fill(#008B00);
rect(startX+posX, startY+space*5+posY, wide, high);
fill(#FFFF00);
textSize(30);
text("0%", startX+115+posX, startY+340+posY);
fill(#0000CD);
textSize(75);
text("Battery", startX-5+posX, startY+450+posY);
    }

Link Video Presentation Resort Managemant System Project.

Video Presentation Resort Managemant System Project. จัดทำโดย พากษ์เสียง: คุณาสิน  ทองมณี  5801012620011 ลำดับภาพ: สุพิชชา  ศรีศิริ...