void setup() {
size(400, 600);
}
void draw() {
background(0);
int X=mouseX; // X is reference point of balloon in x line
int Y=mouseY; // Y is reference point of balloon in y line
//set rule for set colour in top and bottom and set limit hight
if (Y<50) {
Y=50;
fill(0, 255, 0);
} else if (Y>500) {
fill(0, 0, 255);
Y=500;
} else {
fill(255);
}
// call function draw_balloon
draw_balloon(X, Y);
}
//make function for draw balloon
void draw_balloon(int X, int Y) {
ellipse(X, Y, 50, 50); //draw balloon
stroke(255);
line(X, Y, X, Y+100); //draw string
}
วันอาทิตย์ที่ 30 สิงหาคม พ.ศ. 2558
LAB 2 CLOCK Analog
void setup(){
size(600,600);
}
void draw(){
background(0);
// set reference point of circle
int X=300;
int Y=300;
// set diameter and radiuse
int diameter=360;
float r=diameter/2;
// set body clock
stroke(255);
fill(255);
ellipse(X,Y,diameter+40,diameter+40);
fill(0);
ellipse(X,Y,diameter,diameter);
secondLine(r,X,Y);
minuteLine(r,X,Y);
hourLine(r,X,Y);
stroke(255);
point(X,Y);
}
// set start point of point2 in anyline
float pointX=0;
float pointY=0;
// MAKE function of second line
//r is radiuse x and y is reference point
void secondLine(float r,int X,int Y){
// set angle of second line
float angle=map(second(),0,60,0,TWO_PI)-HALF_PI;
strokeWeight(3);
stroke(255,0,0);
//set point of x and y in point2 of line
pointX=X+(r*0.8)*cos(angle);
pointY=Y+(r*0.8)*sin(angle);
line(X,Y,pointX,pointY);
strokeWeight(7);
point(X+r*cos(angle),Y+r*sin(angle));
}
// MAKE function of minute line
//r is radiuse x and y is reference point
void minuteLine(float r,int X,int Y){
float angle =map(minute()+ norm(second(), 0, 60),0,60,0,TWO_PI)-HALF_PI;
strokeWeight(4);
stroke(0,255,0);
pointX=X+(r*0.6)*cos(angle);
pointY=Y+(r*0.6)*sin(angle);
line(X,Y,pointX,pointY);
strokeWeight(7);
point(X+r*cos(angle),Y+r*sin(angle));
}
// MAKE function of Hour line
//r is radiuse x and y is reference point
void hourLine(float r,int X,int Y){
float angle =map(hour()+ norm(minute(), 0, 60),0,24,0,TWO_PI*2)-HALF_PI;
strokeWeight(5);
stroke(0,0,255);
pointX=X+(r*0.4)*cos(angle);
pointY=Y+(r*0.4)*sin(angle);
line(X,Y,pointX,pointY);
strokeWeight(7);
point(X+r*cos(angle),Y+r*sin(angle));
}
size(600,600);
}
void draw(){
background(0);
// set reference point of circle
int X=300;
int Y=300;
// set diameter and radiuse
int diameter=360;
float r=diameter/2;
// set body clock
stroke(255);
fill(255);
ellipse(X,Y,diameter+40,diameter+40);
fill(0);
ellipse(X,Y,diameter,diameter);
secondLine(r,X,Y);
minuteLine(r,X,Y);
hourLine(r,X,Y);
stroke(255);
point(X,Y);
}
// set start point of point2 in anyline
float pointX=0;
float pointY=0;
// MAKE function of second line
//r is radiuse x and y is reference point
void secondLine(float r,int X,int Y){
// set angle of second line
float angle=map(second(),0,60,0,TWO_PI)-HALF_PI;
strokeWeight(3);
stroke(255,0,0);
//set point of x and y in point2 of line
pointX=X+(r*0.8)*cos(angle);
pointY=Y+(r*0.8)*sin(angle);
line(X,Y,pointX,pointY);
strokeWeight(7);
point(X+r*cos(angle),Y+r*sin(angle));
}
// MAKE function of minute line
//r is radiuse x and y is reference point
void minuteLine(float r,int X,int Y){
float angle =map(minute()+ norm(second(), 0, 60),0,60,0,TWO_PI)-HALF_PI;
strokeWeight(4);
stroke(0,255,0);
pointX=X+(r*0.6)*cos(angle);
pointY=Y+(r*0.6)*sin(angle);
line(X,Y,pointX,pointY);
strokeWeight(7);
point(X+r*cos(angle),Y+r*sin(angle));
}
// MAKE function of Hour line
//r is radiuse x and y is reference point
void hourLine(float r,int X,int Y){
float angle =map(hour()+ norm(minute(), 0, 60),0,24,0,TWO_PI*2)-HALF_PI;
strokeWeight(5);
stroke(0,0,255);
pointX=X+(r*0.4)*cos(angle);
pointY=Y+(r*0.4)*sin(angle);
line(X,Y,pointX,pointY);
strokeWeight(7);
point(X+r*cos(angle),Y+r*sin(angle));
}
LAB 2 Digital clock
void setup(){
size(800,500);
}
void draw(){
background(0);
textSize(90);
fill(255,0,0);
text(hour(),200,250);
text(" :"+minute(),250,250);
text(" :"+second(),400,250);
textSize(40);
text("Hour minute second",200,150);
}
size(800,500);
}
void draw(){
background(0);
textSize(90);
fill(255,0,0);
text(hour(),200,250);
text(" :"+minute(),250,250);
text(" :"+second(),400,250);
textSize(40);
text("Hour minute second",200,150);
}
LAB BUG , Error 1
BUG หรือ Error ต่างๆ
- Error on"," condider adding "formalParameter"
เกิดจาก ใน ฟังก์ชั่น void body(int X, int Y,){
มี เครื่องหมาย " , " เกินมา ทางแก้ ไห้ลบออกหรือ เพิ่ม ตัวแปลเข้าไป เช่น
(int X,int Y,intZ){
- Missing a semicolon ";"
เกิดจากการลืมใส่เครื่องหมาย ; หลังจบคำสั่ง
ทางแก้คือใส่ เครื่องหมายsemicolon หลังจบคำสั่ง ที่หายไป
- the function " xxxxxxx" does not exist
เกิดจาก การเรียกใช้คำสั่งฟังก์ชั่นโดยไม่ได้สร้างฟังก์ชั่นนั้นๆ หรือ อาจจะเกิดจากการพิมชื่อฟังก์ชั่นผิดเลยทำไห้โปรแกรม หาฟังก์ชั้นนั้นไม่เจอ
แก้ได้โดย สร้างฟังก์ชั่นเพิ่มหรือ แก้ชื่อฟังก์ชั่นไห้ตรงกัน
LAB2 Assassination Classroom
void setup(){
size(600,600);
}
int mouthY;
// make variable for limit value mouth
int limitMouthY=0;
int slidevalue=0;//for make animation of text
void draw(){
// call function for make background
backGround(196,255,23,0);
backGround(196,200,23,60);
backGround(196,150,23,120);
backGround(196,100,23,180);
backGround(196,50,23,240);
backGround(196,0,23,300);
backGround(196,0,80,360);
backGround(196,0,160,420);
backGround(196,0,240,480);
backGround(140,0,240,540);
// make function for control mouth
if(keyPressed){
if(key=='+'&&limitMouthY<=40){
mouthY++;
limitMouthY++;
}
if(key=='-'&&limitMouthY>=-100){
mouthY--;
limitMouthY--;
}
}
// call function for make face
face(0,0,mouthY);
//call text
assination(slidevalue);
// rule slide
slidevalue--;
if(slidevalue==-600){
slidevalue=600;
}
}
//make function background
void backGround(int R,int G,int B,int X)//R G B is Red Green Blue and X Y is reference point
{
stroke(R,G,B);
fill(R,G,B);
rect(X,0,60,600);
}
//make function for make face and eye
void face(int eyeX,int eyeY,int mouthY)//eye X,Y for move eye in x and y line
{
stroke(0);
strokeWeight(10);
fill(255,231,41);
ellipse(300,300,400,400);//face
strokeWeight(15);
stroke(255,0,0);
point(250+eyeX,200+eyeY);
point(350+eyeX,200+eyeY);
strokeWeight(4);
stroke(0);
fill(250,0,0);
arc(300,300,300,240+mouthY/4,0,PI); //top mouth
fill(255,231,41);
arc(300,300,300,180+mouthY,0,PI); // bottom mouth
tooth(mouthY);
}
//make function tooth
void tooth(int mouthY){
line(180,340+mouthY/3,180,380);
line(210,360+mouthY/2,210,400);
line(240,375+mouthY/2,240,420);
line(270,380+mouthY/2,270,425);
line(300,380+mouthY/2,300,430);
line(330,380+mouthY/2,330,425);
line(360,375+mouthY/2,360,420);
line(390,360+mouthY/2,390,400);
line(420,340+mouthY/3,420,380);
}
//make function for make text
void assination(int X)//x in value of refence
{
textSize(50);
fill(255,235,15);
text(" Assassination Classroom ",X,50);
}
size(600,600);
}
int mouthY;
// make variable for limit value mouth
int limitMouthY=0;
int slidevalue=0;//for make animation of text
void draw(){
// call function for make background
backGround(196,255,23,0);
backGround(196,200,23,60);
backGround(196,150,23,120);
backGround(196,100,23,180);
backGround(196,50,23,240);
backGround(196,0,23,300);
backGround(196,0,80,360);
backGround(196,0,160,420);
backGround(196,0,240,480);
backGround(140,0,240,540);
// make function for control mouth
if(keyPressed){
if(key=='+'&&limitMouthY<=40){
mouthY++;
limitMouthY++;
}
if(key=='-'&&limitMouthY>=-100){
mouthY--;
limitMouthY--;
}
}
// call function for make face
face(0,0,mouthY);
//call text
assination(slidevalue);
// rule slide
slidevalue--;
if(slidevalue==-600){
slidevalue=600;
}
}
//make function background
void backGround(int R,int G,int B,int X)//R G B is Red Green Blue and X Y is reference point
{
stroke(R,G,B);
fill(R,G,B);
rect(X,0,60,600);
}
//make function for make face and eye
void face(int eyeX,int eyeY,int mouthY)//eye X,Y for move eye in x and y line
{
stroke(0);
strokeWeight(10);
fill(255,231,41);
ellipse(300,300,400,400);//face
strokeWeight(15);
stroke(255,0,0);
point(250+eyeX,200+eyeY);
point(350+eyeX,200+eyeY);
strokeWeight(4);
stroke(0);
fill(250,0,0);
arc(300,300,300,240+mouthY/4,0,PI); //top mouth
fill(255,231,41);
arc(300,300,300,180+mouthY,0,PI); // bottom mouth
tooth(mouthY);
}
//make function tooth
void tooth(int mouthY){
line(180,340+mouthY/3,180,380);
line(210,360+mouthY/2,210,400);
line(240,375+mouthY/2,240,420);
line(270,380+mouthY/2,270,425);
line(300,380+mouthY/2,300,430);
line(330,380+mouthY/2,330,425);
line(360,375+mouthY/2,360,420);
line(390,360+mouthY/2,390,400);
line(420,340+mouthY/3,420,380);
}
//make function for make text
void assination(int X)//x in value of refence
{
textSize(50);
fill(255,235,15);
text(" Assassination Classroom ",X,50);
}
วันเสาร์ที่ 29 สิงหาคม พ.ศ. 2558
LAB 2 find area circle
void setup(){
size(600,600);
}
void draw(){
background(0);
textSize(15);
circle(170+mouseX,300,200);
}
//=====function draw circle =====
void circle(int diameter,int X,int Y)//x and y is reference point
{
int r=diameter/2;//r is radiuse
float area=PI*(r*r);
float circleFerence=2*PI*r;
int x=300,y=200;
stroke(0,150,255);
noFill();
ellipse(X,Y,r,r);
diameterLine(r,X,Y);
radiuseLine(r,X,Y);
showValue(diameter,r,area,circleFerence,x,y);
}
//======make function for make diameter line =======
void diameterLine(int r,int X,int Y)//r is radiuse x and y is reference point of circle
{
stroke(255,0,0);
line(X+(r/2),Y,X-(r/2),Y);
text("Diameter",X+(r/6),Y-5);
}
//=====make function for make radiuse line
void radiuseLine(int r,int X,int Y)//r is radiuse x and y is reference point of circle
{
stroke(0,255,0);
line(X,Y,X,Y+(r/2));
text("radius",X+10,Y+(r/4));
}
//====make function for draw text=====
void showValue(int diameter,int r,float area,float circleFerence,int x,int y)
//x and y mean a reference point of text
{
text("The diameter of this circle is "+diameter,X+50,Y+460);
text("The radius of this circle is "+r,X+50,Y+480);
text("The area of this circle is "+area,X+50,Y+500);
text("The circleference of this circle is "+circleFerence,X+50,Y+520);
}
size(600,600);
}
void draw(){
background(0);
textSize(15);
circle(170+mouseX,300,200);
}
//=====function draw circle =====
void circle(int diameter,int X,int Y)//x and y is reference point
{
int r=diameter/2;//r is radiuse
float area=PI*(r*r);
float circleFerence=2*PI*r;
int x=300,y=200;
stroke(0,150,255);
noFill();
ellipse(X,Y,r,r);
diameterLine(r,X,Y);
radiuseLine(r,X,Y);
showValue(diameter,r,area,circleFerence,x,y);
}
//======make function for make diameter line =======
void diameterLine(int r,int X,int Y)//r is radiuse x and y is reference point of circle
{
stroke(255,0,0);
line(X+(r/2),Y,X-(r/2),Y);
text("Diameter",X+(r/6),Y-5);
}
//=====make function for make radiuse line
void radiuseLine(int r,int X,int Y)//r is radiuse x and y is reference point of circle
{
stroke(0,255,0);
line(X,Y,X,Y+(r/2));
text("radius",X+10,Y+(r/4));
}
//====make function for draw text=====
void showValue(int diameter,int r,float area,float circleFerence,int x,int y)
//x and y mean a reference point of text
{
text("The diameter of this circle is "+diameter,X+50,Y+460);
text("The radius of this circle is "+r,X+50,Y+480);
text("The area of this circle is "+area,X+50,Y+500);
text("The circleference of this circle is "+circleFerence,X+50,Y+520);
}
LAB 2 BMI function
void setup(){
size(400,800);
background(0);
textSize(20);
BMI(57,171,10,10);//call function
text("your BMI is "+Bmi(57,171),10,300);
}
//====make function find BMI======
void BMI(float weight,float hight,int X,int Y)//x and y mean a point of text
{
float BMI= weight/((hight/100)*(hight/100));
text("Your weight is " +weight,X,Y+20);
text("Your hight is " +hight,X,Y+50);
text("Your BMI is " +BMI,X,Y+80);
}
float Bmi(float weight,float hight)
{
float BMI= weight/((hight/100)*(hight/100));
return BMI;
}
size(400,800);
background(0);
textSize(20);
BMI(57,171,10,10);//call function
text("your BMI is "+Bmi(57,171),10,300);
}
//====make function find BMI======
void BMI(float weight,float hight,int X,int Y)//x and y mean a point of text
{
float BMI= weight/((hight/100)*(hight/100));
text("Your weight is " +weight,X,Y+20);
text("Your hight is " +hight,X,Y+50);
text("Your BMI is " +BMI,X,Y+80);
}
float Bmi(float weight,float hight)
{
float BMI= weight/((hight/100)*(hight/100));
return BMI;
}
LAB 2 แบตเตอร์รี่ โดยใช้ ฟังก์ชั่น
void setup(){
size(500,900);
}
void draw(){
background(0);
noStroke();
fill(255);
body(100,250);
rect_vertical(160,50);
rect_horizon(160,50);
rect_horizon(160,600);
energy(100,250);
}
//=====make body battery=======
void body(int X,int Y){
rect(X+60,Y+80,180,250);
rect(X+105,Y+30,90,50);
}
// ====make variable in global=====
int colour=0; //change colour
int limit_colour=0; //for limit value colour
//======make energy=====
void energy(int X,int Y){
chang_colour();
stroke(0+(colour*2),150,255-(colour*2));
noFill();
rect(X+70,Y+100,160,220);
noStroke();
fill(0+(colour*2),150,255-(colour*2));
rect(X+70,Y+100+limit_colour,160,220-limit_colour);
}
// ====make change clour and turn down or up energy======
void chang_colour(){
if((mouseButton==LEFT&&limit_colour>0)&&((mouseX>=160&&mouseX<=420)&&(mouseY>=50&&mouseY<=250))){
colour--;
limit_colour--;
}
if((mouseButton==LEFT&&limit_colour<=200)&&((mouseX>=160&&mouseX<=420)&&(mouseY>=500&&mouseY<=700))){
colour++;
limit_colour++;
}
}
//======make function for draw rect vertical======
void rect_vertical(int X,int Y){
noStroke();
rect(X+60,Y,60,180);
}
//======make function for draw rect horizon=====
void rect_horizon(int X,int Y){
noStroke();
rect(X,Y+60,180,60);
}
size(500,900);
}
void draw(){
background(0);
noStroke();
fill(255);
body(100,250);
rect_vertical(160,50);
rect_horizon(160,50);
rect_horizon(160,600);
energy(100,250);
}
//=====make body battery=======
void body(int X,int Y){
rect(X+60,Y+80,180,250);
rect(X+105,Y+30,90,50);
}
// ====make variable in global=====
int colour=0; //change colour
int limit_colour=0; //for limit value colour
//======make energy=====
void energy(int X,int Y){
chang_colour();
stroke(0+(colour*2),150,255-(colour*2));
noFill();
rect(X+70,Y+100,160,220);
noStroke();
fill(0+(colour*2),150,255-(colour*2));
rect(X+70,Y+100+limit_colour,160,220-limit_colour);
}
// ====make change clour and turn down or up energy======
void chang_colour(){
if((mouseButton==LEFT&&limit_colour>0)&&((mouseX>=160&&mouseX<=420)&&(mouseY>=50&&mouseY<=250))){
colour--;
limit_colour--;
}
if((mouseButton==LEFT&&limit_colour<=200)&&((mouseX>=160&&mouseX<=420)&&(mouseY>=500&&mouseY<=700))){
colour++;
limit_colour++;
}
}
//======make function for draw rect vertical======
void rect_vertical(int X,int Y){
noStroke();
rect(X+60,Y,60,180);
}
//======make function for draw rect horizon=====
void rect_horizon(int X,int Y){
noStroke();
rect(X,Y+60,180,60);
}
LAB 2 Positive with function
void setup(){
size(500,500);
}
//======make variable in global====
int resize=0; //for plus size
int limit_size=0; //for limit size of positive
void draw(){
background(0);
resize_function();//call function
draw_rect_vertical(mouseX,mouseY,resize); //call function
draw_rect_horizon(mouseX,mouseY,resize); //call function
}
//======make function for draw rect vertical======
void draw_rect_vertical(int X,int Y,int resize){
noStroke();
rect(X+60,Y,60+resize,180+resize);
}
//======make function for draw rect horizon=====
void draw_rect_horizon(int X,int Y,int resize){
noStroke();
rect(X,Y+60,180+resize,60+resize);
}
//========rule for resize======
void resize_function(){
if(key == '+'&&limit_size<40){
resize++;
limit_size++;
}
if(key =='-'&&limit_size>0){
resize--;
limit_size--;
}
}
size(500,500);
}
//======make variable in global====
int resize=0; //for plus size
int limit_size=0; //for limit size of positive
void draw(){
background(0);
resize_function();//call function
draw_rect_vertical(mouseX,mouseY,resize); //call function
draw_rect_horizon(mouseX,mouseY,resize); //call function
}
//======make function for draw rect vertical======
void draw_rect_vertical(int X,int Y,int resize){
noStroke();
rect(X+60,Y,60+resize,180+resize);
}
//======make function for draw rect horizon=====
void draw_rect_horizon(int X,int Y,int resize){
noStroke();
rect(X,Y+60,180+resize,60+resize);
}
//========rule for resize======
void resize_function(){
if(key == '+'&&limit_size<40){
resize++;
limit_size++;
}
if(key =='-'&&limit_size>0){
resize--;
limit_size--;
}
}
LAB 2 test Function
//=====set up size=====
void setup(){
size (600,500);
frameRate(10);
}
int click1=0,click2=0,click3=0; //value for set colour black and white
void draw(){
background(255);
stroke(255);
click();
fill(0+click1);
Rect(0,0); // paper1
fill(0+click2);
Rect(200,0); //paper 2
fill(0+click3);
Rect(400,0); //paper 3
//draw day in paper
fill(255);
text("Saturday",50,50);
text("Sunday",50,100);
text("Thursday",50,150);
text("Friday",50,200);
text("Saturday",250,50);
text("Sunday",250,100);
text("Wednesday",250,150);
text("Tuesday",250,200);
text("Monday",450,50);
text("Sunday",450,100);
text("Wednesday",450,150);
text("Friday",450,200);
fill(255,0,0);
textSize(30);
showDay(value_day());
//draw pad number
text("1",10,30);
text("2",210,30);
text("3",410,30);
fill(0);
textSize(15);
text(" Please Thing a number in your mind",150,350);
text("And Choose a paper Without that Day With number pad1-3",80,400);
}
//=====function for draw paper====
void Rect(int X,int Y){
rect(X,Y,200,300);
}
int count_limit_click1;
int count_limit_click2;
int count_limit_click3;
//====function for set value of click
void click(){
click_one(); //use value that return from click_one
click_two(); //use value that return from click_two
click_three(); //use value that return from click_three
}
//===set rule for setup value click number 1===
int click_one(){
if(keyPressed){
if(key=='1')
{
count_limit_click1++;
if(count_limit_click1==1){
click1=255;
}
else{
click1=0;
}
if(count_limit_click1==2){
count_limit_click1=0;
}
}
}
return click1;
}
//===set rule for setup value click number 2====
int click_two(){
if(keyPressed){
if(key=='2')
{
count_limit_click2++;
if(count_limit_click2==1){
click2=255;
}
else{
click2=0;
}
if(count_limit_click2==2){
count_limit_click2=0;
}
}
}
return click2;
}
//===set rule for setup value click number 3===
int click_three(){
if(keyPressed){
if(key=='3')
{
count_limit_click3++;
if(count_limit_click3==1){
click3=255;
}
else{
click3=0;
}
}
if(count_limit_click3==2){
count_limit_click3=0;
}
}
return click3;
}
//====make groble variable====
int number_bit1;
int number_bit2;
int number_bit3;
//===set up rule for fine value bit===
int value_day(){
int value_bit;
// set up from click1
if(click1==255){
number_bit1=0;
}
if(click1==0){
number_bit1=1;}
// set up from click2
if(click2==255){
number_bit2=0;
}
if(click2==0){
number_bit2=1;}
// set up from click3
if(click3==255){
number_bit3=0;
}
if(click3==0){
number_bit3=1;}
value_bit=((4*number_bit1)+(2*number_bit2)+(1*number_bit3)); // calculate a value
return value_bit;
}
//===set rule for trasnfrom bit to day===
void showDay(int value_day)
{
if(value_day()==7){
text("That day is sunday",180,450);
}
if(value_day==6){
text("That day is Saturday",180,450);
}
if(value_day==5){
text("That day is friday",180,450);
}
if(value_day==4){
text("That day is Thursday",180,450);
}
if(value_day==3){
text("That day is Wednesday",180,450);
}
if(value_day==2){
text("That day is Tuesday",180,450);
}
if(value_day==1){
text("That day is Monday",180,450);
}
if(value_day==0){
text("You lie Me",200,450);
}
}
void setup(){
size (600,500);
frameRate(10);
}
int click1=0,click2=0,click3=0; //value for set colour black and white
void draw(){
background(255);
stroke(255);
click();
fill(0+click1);
Rect(0,0); // paper1
fill(0+click2);
Rect(200,0); //paper 2
fill(0+click3);
Rect(400,0); //paper 3
//draw day in paper
fill(255);
text("Saturday",50,50);
text("Sunday",50,100);
text("Thursday",50,150);
text("Friday",50,200);
text("Saturday",250,50);
text("Sunday",250,100);
text("Wednesday",250,150);
text("Tuesday",250,200);
text("Monday",450,50);
text("Sunday",450,100);
text("Wednesday",450,150);
text("Friday",450,200);
fill(255,0,0);
textSize(30);
showDay(value_day());
//draw pad number
text("1",10,30);
text("2",210,30);
text("3",410,30);
fill(0);
textSize(15);
text(" Please Thing a number in your mind",150,350);
text("And Choose a paper Without that Day With number pad1-3",80,400);
}
//=====function for draw paper====
void Rect(int X,int Y){
rect(X,Y,200,300);
}
int count_limit_click1;
int count_limit_click2;
int count_limit_click3;
//====function for set value of click
void click(){
click_one(); //use value that return from click_one
click_two(); //use value that return from click_two
click_three(); //use value that return from click_three
}
//===set rule for setup value click number 1===
int click_one(){
if(keyPressed){
if(key=='1')
{
count_limit_click1++;
if(count_limit_click1==1){
click1=255;
}
else{
click1=0;
}
if(count_limit_click1==2){
count_limit_click1=0;
}
}
}
return click1;
}
//===set rule for setup value click number 2====
int click_two(){
if(keyPressed){
if(key=='2')
{
count_limit_click2++;
if(count_limit_click2==1){
click2=255;
}
else{
click2=0;
}
if(count_limit_click2==2){
count_limit_click2=0;
}
}
}
return click2;
}
//===set rule for setup value click number 3===
int click_three(){
if(keyPressed){
if(key=='3')
{
count_limit_click3++;
if(count_limit_click3==1){
click3=255;
}
else{
click3=0;
}
}
if(count_limit_click3==2){
count_limit_click3=0;
}
}
return click3;
}
//====make groble variable====
int number_bit1;
int number_bit2;
int number_bit3;
//===set up rule for fine value bit===
int value_day(){
int value_bit;
// set up from click1
if(click1==255){
number_bit1=0;
}
if(click1==0){
number_bit1=1;}
// set up from click2
if(click2==255){
number_bit2=0;
}
if(click2==0){
number_bit2=1;}
// set up from click3
if(click3==255){
number_bit3=0;
}
if(click3==0){
number_bit3=1;}
value_bit=((4*number_bit1)+(2*number_bit2)+(1*number_bit3)); // calculate a value
return value_bit;
}
//===set rule for trasnfrom bit to day===
void showDay(int value_day)
{
if(value_day()==7){
text("That day is sunday",180,450);
}
if(value_day==6){
text("That day is Saturday",180,450);
}
if(value_day==5){
text("That day is friday",180,450);
}
if(value_day==4){
text("That day is Thursday",180,450);
}
if(value_day==3){
text("That day is Wednesday",180,450);
}
if(value_day==2){
text("That day is Tuesday",180,450);
}
if(value_day==1){
text("That day is Monday",180,450);
}
if(value_day==0){
text("You lie Me",200,450);
}
}
วันอาทิตย์ที่ 23 สิงหาคม พ.ศ. 2558
LAB 1 ชิ้นที่ 5 คำนวนค่า BMI
void setup(){
float w; //weight
float h; //hight
float BMI; //BMI IS BODY MASS INDEX
size(300,300);
background(0);
//set up
w=57;
h=171;
BMI = w / ((h/100) * (h/100));
textSize(15);
//show value
text("weight = "+w,100,130);
text("hight = "+h,100,110);
text("BMI = "+BMI,100,150);
}
float w; //weight
float h; //hight
float BMI; //BMI IS BODY MASS INDEX
size(300,300);
background(0);
//set up
w=57;
h=171;
BMI = w / ((h/100) * (h/100));
textSize(15);
//show value
text("weight = "+w,100,130);
text("hight = "+h,100,110);
text("BMI = "+BMI,100,150);
}
LAB 1 งานชิ้นที 4 หาพื้นที่วงกลมและเส้นรอบวง
CODE
void setup(){
size(600,600);
}
int d; //diameter of circle
int r; //radiuse of circle
float area; //area of circle
float circleF;//circleF is circleference
void draw(){
background(0);
d=100+mouseX; //set diameter frome mouseX
// set up theory
r=d/2;
area=PI*(r*r);
circleF=2*PI*r;
//circle picture
stroke(255);
noFill();
ellipse(300,200,r,r);
//line of diameter in x line
stroke(255,0,0);
text("diameter",300+(r/6),195);
line(300+(r/2),200,300-(r/2),200);
//line of radius in Y line
stroke(0,255,0);
line(300,200,300,200+(r/2));
text("radius",310,200+(r/4));
//show value
text("The diameter of this circle is "+d,50,460);
text("The radius of this circle is "+r,50,480);
text("The area of this circle is "+area,50,500);
text("The circleference of this circle is "+circleF,50,520);
}
void setup(){
size(600,600);
}
int d; //diameter of circle
int r; //radiuse of circle
float area; //area of circle
float circleF;//circleF is circleference
void draw(){
background(0);
d=100+mouseX; //set diameter frome mouseX
// set up theory
r=d/2;
area=PI*(r*r);
circleF=2*PI*r;
//circle picture
stroke(255);
noFill();
ellipse(300,200,r,r);
//line of diameter in x line
stroke(255,0,0);
text("diameter",300+(r/6),195);
line(300+(r/2),200,300-(r/2),200);
//line of radius in Y line
stroke(0,255,0);
line(300,200,300,200+(r/2));
text("radius",310,200+(r/4));
//show value
text("The diameter of this circle is "+d,50,460);
text("The radius of this circle is "+r,50,480);
text("The area of this circle is "+area,50,500);
text("The circleference of this circle is "+circleF,50,520);
}
วันเสาร์ที่ 22 สิงหาคม พ.ศ. 2558
LAB 1 งานชิ้นที่ 3 งานจากLab 0
CODE
void setup(){
size(900,610);
background(0);
frameRate(200);
}
// set up valiable and setup base value
int X=1; //X is value for move picture and up size background in x line
int Y=1; //Y is value for move picture and up size background in Y line
int limitX=1;//value for limit moveing in X line
void draw(){
// set up rule for move forward and return
if(limitX>=0&&X<500)
{
X++;
limitX++;
}
if(limitX==500){
limitX=-500;
}
if(limitX<0&&X>0){
X--;
limitX++;
}
//background of book
stroke(0);
fill(255,204,0);
rect(X,Y,400,600);
//+++++crown+++++
noStroke();
fill(#ffff00);
rect(X+81,Y+305,250,100);
triangle(X+81,Y+305,X+81,Y+205,X+120,Y+305);
triangle(X+140,Y+305,X+180,Y+305,X+160,Y+205);
triangle(X+200,Y+305,X+240,Y+305,X+220,Y+205);
triangle(X+250,Y+305,X+290,Y+305,X+280,Y+205);
triangle(X+290,Y+305,X+331,Y+305,X+331,Y+205);
//++++headline+++++
fill(255-X,100,limitX);
rect(X+0,Y+50,400,50);
//+++line of light crown++++
stroke(205,204,0);
strokeWeight(5);
line(X+81,Y+310,X+331,Y+310);
line(X+81,Y+340,X+331,Y+340);
//+++Game of Thone+++
fill(255);
textSize(30);
text("Game of Thone",X+100,Y+75);
//+++a new original serie from HBO++++
textSize(15);
text("A New Original Serie from HBO",X+105,Y+95);
//++++#1 New york time bestselling author+++++
fill(240);
textSize(20);
text("#1 New York Time Bestselling Author",X+20,Y+120);
//+++GEORGE R.R++++
fill(250);
textSize(50);
text("GEORGE R.R.",X+50,Y+170);
//++MARTIN++++
textSize(40);
text("MARTIN",X+135,Y+205);
//++A OF++
textSize(25);
text("A OF",X+70,Y+500);
//++CLASH+++
textSize(60);
text("CLASH",X+100,Y+500);
//++KINGS+++
text("KINGS",X+110,Y+550);
}
void setup(){
size(900,610);
background(0);
frameRate(200);
}
// set up valiable and setup base value
int X=1; //X is value for move picture and up size background in x line
int Y=1; //Y is value for move picture and up size background in Y line
int limitX=1;//value for limit moveing in X line
void draw(){
// set up rule for move forward and return
if(limitX>=0&&X<500)
{
X++;
limitX++;
}
if(limitX==500){
limitX=-500;
}
if(limitX<0&&X>0){
X--;
limitX++;
}
//background of book
stroke(0);
fill(255,204,0);
rect(X,Y,400,600);
//+++++crown+++++
noStroke();
fill(#ffff00);
rect(X+81,Y+305,250,100);
triangle(X+81,Y+305,X+81,Y+205,X+120,Y+305);
triangle(X+140,Y+305,X+180,Y+305,X+160,Y+205);
triangle(X+200,Y+305,X+240,Y+305,X+220,Y+205);
triangle(X+250,Y+305,X+290,Y+305,X+280,Y+205);
triangle(X+290,Y+305,X+331,Y+305,X+331,Y+205);
//++++headline+++++
fill(255-X,100,limitX);
rect(X+0,Y+50,400,50);
//+++line of light crown++++
stroke(205,204,0);
strokeWeight(5);
line(X+81,Y+310,X+331,Y+310);
line(X+81,Y+340,X+331,Y+340);
//+++Game of Thone+++
fill(255);
textSize(30);
text("Game of Thone",X+100,Y+75);
//+++a new original serie from HBO++++
textSize(15);
text("A New Original Serie from HBO",X+105,Y+95);
//++++#1 New york time bestselling author+++++
fill(240);
textSize(20);
text("#1 New York Time Bestselling Author",X+20,Y+120);
//+++GEORGE R.R++++
fill(250);
textSize(50);
text("GEORGE R.R.",X+50,Y+170);
//++MARTIN++++
textSize(40);
text("MARTIN",X+135,Y+205);
//++A OF++
textSize(25);
text("A OF",X+70,Y+500);
//++CLASH+++
textSize(60);
text("CLASH",X+100,Y+500);
//++KINGS+++
text("KINGS",X+110,Y+550);
}
วันจันทร์ที่ 17 สิงหาคม พ.ศ. 2558
LAB 1 งานชิ้นที 2 Battery
CODE
void setup(){
size(600,600);
}
int x=5; //x is value of start point in x line
int y=10; //y is value of start point in y line
int sizeFront=0;//sizeFront is value for plus size text
int limit_X_line=1;//limit for move in X line
int limit_Y_line=1;//limit for move in y line
int upSize=0;//value for upsize battery
void draw(){
background(0);
stroke(255);
fill(255);
//body
rect(x+50,y+0,upSize+100,upSize+50);
stroke(0);
rect(x+20,y+50,upSize+160,upSize+250);
//energy
fill(0,150,0);
rect(x+25,y+55,upSize+150,(upSize/8)+30);
fill(0,170,0);
rect(x+25,(upSize/8)+y+90,upSize+150,(upSize/8)+30);
fill(0,190,0);
rect(x+25,((upSize/8)*2)+y+125,upSize+150,(upSize/8)+30);
fill(0,220,0);
rect(x+25,((upSize/8)*3)+y+160,upSize+150,(upSize/8)+30);
fill(0,230,0);
rect(x+25,((upSize/8)*4)+y+195,upSize+150,(upSize/8)+30);
fill(0,240,0);
rect(x+25,((upSize/8)*5)+y+230,upSize+150,(upSize/8)+30);
fill(0,250,0);
rect(x+25,((upSize/8)*6)+y+265,upSize+150,(upSize/8)+30);
//text of %
fill(250,200,0);
textSize(sizeFront+30);
text("100%",x+65+(upSize/2),y+40);
// set up key for move
if(keyPressed){
if((key == 'd'||key == 'D')&&limit_X_line<400)
{
x++;
limit_X_line++;
}
if((key == 'a'|| key == 'A')&&limit_X_line>0)
{
x--;
limit_X_line--;
}
}
if(keyPressed){
if((key == 's'||key == 'S')&&limit_Y_line<260)
{
y++;
limit_Y_line++;
}
if((key == 'w'|| key == 'W')&&limit_Y_line>0)
{
y--;
limit_Y_line--;
}
}
// set key for resize
if ((mousePressed && (mouseButton == LEFT))&&upSize<40)
{
upSize++;
} else if ((mousePressed && (mouseButton == RIGHT))&&upSize>=0)
{
upSize--;
}
}
void setup(){
size(600,600);
}
int x=5; //x is value of start point in x line
int y=10; //y is value of start point in y line
int sizeFront=0;//sizeFront is value for plus size text
int limit_X_line=1;//limit for move in X line
int limit_Y_line=1;//limit for move in y line
int upSize=0;//value for upsize battery
void draw(){
background(0);
stroke(255);
fill(255);
//body
rect(x+50,y+0,upSize+100,upSize+50);
stroke(0);
rect(x+20,y+50,upSize+160,upSize+250);
//energy
fill(0,150,0);
rect(x+25,y+55,upSize+150,(upSize/8)+30);
fill(0,170,0);
rect(x+25,(upSize/8)+y+90,upSize+150,(upSize/8)+30);
fill(0,190,0);
rect(x+25,((upSize/8)*2)+y+125,upSize+150,(upSize/8)+30);
fill(0,220,0);
rect(x+25,((upSize/8)*3)+y+160,upSize+150,(upSize/8)+30);
fill(0,230,0);
rect(x+25,((upSize/8)*4)+y+195,upSize+150,(upSize/8)+30);
fill(0,240,0);
rect(x+25,((upSize/8)*5)+y+230,upSize+150,(upSize/8)+30);
fill(0,250,0);
rect(x+25,((upSize/8)*6)+y+265,upSize+150,(upSize/8)+30);
//text of %
fill(250,200,0);
textSize(sizeFront+30);
text("100%",x+65+(upSize/2),y+40);
// set up key for move
if(keyPressed){
if((key == 'd'||key == 'D')&&limit_X_line<400)
{
x++;
limit_X_line++;
}
if((key == 'a'|| key == 'A')&&limit_X_line>0)
{
x--;
limit_X_line--;
}
}
if(keyPressed){
if((key == 's'||key == 'S')&&limit_Y_line<260)
{
y++;
limit_Y_line++;
}
if((key == 'w'|| key == 'W')&&limit_Y_line>0)
{
y--;
limit_Y_line--;
}
}
// set key for resize
if ((mousePressed && (mouseButton == LEFT))&&upSize<40)
{
upSize++;
} else if ((mousePressed && (mouseButton == RIGHT))&&upSize>=0)
{
upSize--;
}
}
วันอาทิตย์ที่ 16 สิงหาคม พ.ศ. 2558
LAB 1 งานชิ้นที1 Positive sign
CODE
int x; //x is reference point in x line
int y;//y is reference point in y line
int sizeX=10;//sizeX is value for up size in x line
int sizeY=10;//sizeY is value for up size in y line
int relate=1; //for limit size of positive
void draw(){
size(900,900);
background(204,204,0);
//set up a value reference
x =mouseX;
y =mouseY;
//stroke set up
noStroke();
strokeWeight(3);
fill(100,0,0);
//make rect for positive
rect(x,y+65,sizeX+200,sizeY+50);
rect(x+75,y,sizeX+50,sizeY+200);
// set key for set up size
if(keyPressed){
if(key == '+'&&relate<40){
sizeX++;
sizeY++;
relate++;
}
if(key == '-'&&relate>0){
sizeX--;
sizeY--;
relate--;
}
}
}
int x; //x is reference point in x line
int y;//y is reference point in y line
int sizeX=10;//sizeX is value for up size in x line
int sizeY=10;//sizeY is value for up size in y line
int relate=1; //for limit size of positive
void draw(){
size(900,900);
background(204,204,0);
//set up a value reference
x =mouseX;
y =mouseY;
//stroke set up
noStroke();
strokeWeight(3);
fill(100,0,0);
//make rect for positive
rect(x,y+65,sizeX+200,sizeY+50);
rect(x+75,y,sizeX+50,sizeY+200);
// set key for set up size
if(keyPressed){
if(key == '+'&&relate<40){
sizeX++;
sizeY++;
relate++;
}
if(key == '-'&&relate>0){
sizeX--;
sizeY--;
relate--;
}
}
}
LAB O ชิ้นที่ 4
CODE
void setup(){
size(400,600);
background(255,204,0);
//+++++crown+++++
noStroke();
fill(#ffff00);
rect(81,305,250,100);
triangle(81,305,81,205,120,305);
triangle(140,305,180,305,160,205);
triangle(200,305,240,305,220,205);
triangle(250,305,290,305,280,205);
triangle(290,305,331,305,331,205);
//++++headline+++++
fill(255,100,0);
rect(0,50,400,50);
//+++line of light crown++++
stroke(205,204,0);
strokeWeight(5);
line(81,310,331,310);
line(81,340,331,340);
//+++Game of Thone+++
fill(255);
textSize(30);
text("Game of Thone",100,75);
//+++a new original serie from HBO++++
textSize(15);
text("A New Original Serie from HBO",105,95);
//++++#1 New york time bestselling author+++++
fill(240);
textSize(20);
text("#1 New York Time Bestselling Author",20,120);
//+++GEORGE R.R++++
fill(250);
textSize(50);
text("GEORGE R.R.",50,170);
//++MARTIN++++
textSize(40);
text("MARTIN",135,205);
//++A OF++
textSize(25);
text("A OF",70,500);
//++CLASH+++
textSize(60);
text("CLASH",100,500);
//++KINGS+++
text("KINGS",110,550);
}
void setup(){
size(400,600);
background(255,204,0);
//+++++crown+++++
noStroke();
fill(#ffff00);
rect(81,305,250,100);
triangle(81,305,81,205,120,305);
triangle(140,305,180,305,160,205);
triangle(200,305,240,305,220,205);
triangle(250,305,290,305,280,205);
triangle(290,305,331,305,331,205);
//++++headline+++++
fill(255,100,0);
rect(0,50,400,50);
//+++line of light crown++++
stroke(205,204,0);
strokeWeight(5);
line(81,310,331,310);
line(81,340,331,340);
//+++Game of Thone+++
fill(255);
textSize(30);
text("Game of Thone",100,75);
//+++a new original serie from HBO++++
textSize(15);
text("A New Original Serie from HBO",105,95);
//++++#1 New york time bestselling author+++++
fill(240);
textSize(20);
text("#1 New York Time Bestselling Author",20,120);
//+++GEORGE R.R++++
fill(250);
textSize(50);
text("GEORGE R.R.",50,170);
//++MARTIN++++
textSize(40);
text("MARTIN",135,205);
//++A OF++
textSize(25);
text("A OF",70,500);
//++CLASH+++
textSize(60);
text("CLASH",100,500);
//++KINGS+++
text("KINGS",110,550);
}
LAB 0 ชิ้นที่ 3
CODE
void setup() {
size(960, 540);
background(235);
//+++ TOP BACKGROUND++++
noStroke();
fill(200);
ellipse(960, 0, 1900, 500);
fill(170);
ellipse(960, 0, 1600, 400);
fill(140);
ellipse(960, 0, 1300, 300);
fill(110);
ellipse(960, 0, 1000, 200);
fill(80);
ellipse(960, 0, 700, 100);
//+++Floor+++
fill(50);
rect(0, 275, 960, 300);
fill(55);
rect(40,275,960,300);
fill(60);
rect(80,275,960,300);
fill(65);
rect(120,275,960,300);
fill(70);
rect(160,275,960,300);
fill(75);
rect(200,275,960,300);
fill(80);
rect(240,275,960,300);
fill(85);
rect(280,275,960,300);
fill(90);
rect(320,275,960,300);
fill(95);
rect(360,275,960,300);
fill(100);
rect(400,275,960,300);
fill(105);
rect(440,275,960,300);
fill(110);
rect(480,275,960,300);
fill(115);
rect(520,275,960,300);
fill(120);
rect(560,275,960,300);
fill(125);
rect(600,275,960,300);
fill(130);
rect(640,275,960,300);
fill(135);
rect(680,275,960,300);
fill(140);
rect(720,275,960,300);
fill(145);
rect(760,275,960,300);
fill(150);
rect(800,275,960,300);
fill(160);
rect(840,275,960,300);
fill(170);
rect(880,275,960,300);
//++++road+++++
fill(20);
beginShape();
vertex(0,540);
vertex(960,540);
vertex(520,275);
vertex(450,275);
endShape(CLOSE);
stroke(255); //white Line road left
strokeWeight(5);
fill(255);
line(20,540,460,276);
line(940,540,510,276);
//++Name album+++
stroke(50);
strokeWeight(3);
fill(#E3AF8C);
//++Word "L"+++
beginShape();
vertex(327,248);
vertex(337,248);
vertex(337,161);
vertex(324,160);
vertex(324,164);
vertex(329,165);
endShape(CLOSE);
///+++Word E(1)+++
beginShape();
vertex(348,248);
vertex(375,248);
vertex(375,229);
vertex(367,229);
vertex(367,243);
vertex(355,243);
vertex(355,218);
vertex(376,218);
vertex(376,208);
vertex(355,208);
vertex(355,190);
vertex(377,190);
vertex(377,185);
vertex(348,185);
endShape(CLOSE);
// ++Word T++
beginShape();
vertex(386,248);
vertex(396,248);
vertex(396,172);
vertex(405,172);
vertex(405,168);
vertex(375,168);
vertex(375,172);
vertex(386,172);
endShape(CLOSE);
//++Word H++
beginShape();
vertex(435,248);
vertex(448,248);
vertex(448,230);
vertex(455,230);
vertex(455,248);
vertex(470,248);
vertex(470,172);
vertex(455,172);
vertex(455,190);
vertex(448,190);
vertex(448,172);
vertex(435,172);
endShape(CLOSE);
///+++Word E(2)+++
beginShape();
vertex(478,248);
vertex(505,248);
vertex(505,229);
vertex(497,229);
vertex(497,243);
vertex(485,243);
vertex(485,218);
vertex(506,218);
vertex(506,208);
vertex(485,208);
vertex(485,190);
vertex(507,190);
vertex(507,185);
vertex(478,185);
endShape(CLOSE);
//++Word r++
beginShape();
vertex(511,248);
vertex(520,248);
vertex(520,190);
vertex(535,190);
vertex(535,183);
vertex(520,183);
vertex(520,172);
vertex(511,172);
endShape(CLOSE);
//++word G+++
beginShape();
vertex(556,248);
vertex(590,248);
vertex(590,210);
vertex(570,210);
vertex(570,215);
vertex(575,215);
vertex(575,240);
vertex(570,240);
vertex(570,180);
vertex(590,180);
vertex(590,172);
vertex(556,172);
endShape(CLOSE);
//++word O++
ellipse(621,214,50,80);
fill(200);
ellipse(621,214,15,45);
//++++Mountain++++ (LEFT)
noStroke();
fill(90);
beginShape();
vertex(104, 245);
vertex(342, 284);
vertex(104, 284);
endShape(CLOSE);
fill(70);
beginShape();
vertex(0, 220);
vertex(277, 284);
vertex(0, 284);
endShape(CLOSE);
//++++Mountain++++right
beginShape();
vertex(534, 277);
vertex(900, 241);
vertex(757, 277);
endShape(CLOSE);
fill(90);
beginShape();
vertex(684, 281);
vertex(894, 229);
vertex(894, 281);
endShape(CLOSE);
fill(120);
beginShape();
vertex(733, 284);
vertex(965, 200);
vertex(965, 284);
endShape(CLOSE);
}
void setup() {
size(960, 540);
background(235);
//+++ TOP BACKGROUND++++
noStroke();
fill(200);
ellipse(960, 0, 1900, 500);
fill(170);
ellipse(960, 0, 1600, 400);
fill(140);
ellipse(960, 0, 1300, 300);
fill(110);
ellipse(960, 0, 1000, 200);
fill(80);
ellipse(960, 0, 700, 100);
//+++Floor+++
fill(50);
rect(0, 275, 960, 300);
fill(55);
rect(40,275,960,300);
fill(60);
rect(80,275,960,300);
fill(65);
rect(120,275,960,300);
fill(70);
rect(160,275,960,300);
fill(75);
rect(200,275,960,300);
fill(80);
rect(240,275,960,300);
fill(85);
rect(280,275,960,300);
fill(90);
rect(320,275,960,300);
fill(95);
rect(360,275,960,300);
fill(100);
rect(400,275,960,300);
fill(105);
rect(440,275,960,300);
fill(110);
rect(480,275,960,300);
fill(115);
rect(520,275,960,300);
fill(120);
rect(560,275,960,300);
fill(125);
rect(600,275,960,300);
fill(130);
rect(640,275,960,300);
fill(135);
rect(680,275,960,300);
fill(140);
rect(720,275,960,300);
fill(145);
rect(760,275,960,300);
fill(150);
rect(800,275,960,300);
fill(160);
rect(840,275,960,300);
fill(170);
rect(880,275,960,300);
//++++road+++++
fill(20);
beginShape();
vertex(0,540);
vertex(960,540);
vertex(520,275);
vertex(450,275);
endShape(CLOSE);
stroke(255); //white Line road left
strokeWeight(5);
fill(255);
line(20,540,460,276);
line(940,540,510,276);
//++Name album+++
stroke(50);
strokeWeight(3);
fill(#E3AF8C);
//++Word "L"+++
beginShape();
vertex(327,248);
vertex(337,248);
vertex(337,161);
vertex(324,160);
vertex(324,164);
vertex(329,165);
endShape(CLOSE);
///+++Word E(1)+++
beginShape();
vertex(348,248);
vertex(375,248);
vertex(375,229);
vertex(367,229);
vertex(367,243);
vertex(355,243);
vertex(355,218);
vertex(376,218);
vertex(376,208);
vertex(355,208);
vertex(355,190);
vertex(377,190);
vertex(377,185);
vertex(348,185);
endShape(CLOSE);
// ++Word T++
beginShape();
vertex(386,248);
vertex(396,248);
vertex(396,172);
vertex(405,172);
vertex(405,168);
vertex(375,168);
vertex(375,172);
vertex(386,172);
endShape(CLOSE);
//++Word H++
beginShape();
vertex(435,248);
vertex(448,248);
vertex(448,230);
vertex(455,230);
vertex(455,248);
vertex(470,248);
vertex(470,172);
vertex(455,172);
vertex(455,190);
vertex(448,190);
vertex(448,172);
vertex(435,172);
endShape(CLOSE);
///+++Word E(2)+++
beginShape();
vertex(478,248);
vertex(505,248);
vertex(505,229);
vertex(497,229);
vertex(497,243);
vertex(485,243);
vertex(485,218);
vertex(506,218);
vertex(506,208);
vertex(485,208);
vertex(485,190);
vertex(507,190);
vertex(507,185);
vertex(478,185);
endShape(CLOSE);
//++Word r++
beginShape();
vertex(511,248);
vertex(520,248);
vertex(520,190);
vertex(535,190);
vertex(535,183);
vertex(520,183);
vertex(520,172);
vertex(511,172);
endShape(CLOSE);
//++word G+++
beginShape();
vertex(556,248);
vertex(590,248);
vertex(590,210);
vertex(570,210);
vertex(570,215);
vertex(575,215);
vertex(575,240);
vertex(570,240);
vertex(570,180);
vertex(590,180);
vertex(590,172);
vertex(556,172);
endShape(CLOSE);
//++word O++
ellipse(621,214,50,80);
fill(200);
ellipse(621,214,15,45);
//++++Mountain++++ (LEFT)
noStroke();
fill(90);
beginShape();
vertex(104, 245);
vertex(342, 284);
vertex(104, 284);
endShape(CLOSE);
fill(70);
beginShape();
vertex(0, 220);
vertex(277, 284);
vertex(0, 284);
endShape(CLOSE);
//++++Mountain++++right
beginShape();
vertex(534, 277);
vertex(900, 241);
vertex(757, 277);
endShape(CLOSE);
fill(90);
beginShape();
vertex(684, 281);
vertex(894, 229);
vertex(894, 281);
endShape(CLOSE);
fill(120);
beginShape();
vertex(733, 284);
vertex(965, 200);
vertex(965, 284);
endShape(CLOSE);
}
LAB 0 ชิ้นที่ 2
CODE
void setup(){
size(200,200);
stroke(196,255,23); //background yellow
fill(196,255,23);
rect(0,0,20,200);
stroke(23,255,48); //background green
fill(23,255,48);
rect(20,0,20,200);
stroke(23,255,195); //background blue green
fill(23,255,195);
rect(40,0,20,200);
stroke(223,245,255); //background white
fill(223,245,255);
rect(60,0,20,200);
stroke(23,183,255); //background blue
fill(23,183,255);
rect(80,0,20,200);
stroke(23,83,255); //background hard blue
fill(23,83,255);
rect(100,0,20,200);
stroke(103,23,255); //background purple
fill(103,23,255);
rect(120,0,20,200);
stroke(161,23,255); //background hard purple
fill(161,23,255);
rect(140,0,20,200);
stroke(227,23,255); //background pink
fill(227,23,255);
rect(160,0,20,200);
stroke(255,23,201); //background hard pink
fill(225,23,201);
rect(180,0,20,200);
stroke(0);
strokeWeight(3);
fill(255,231,41);
ellipse(100,100,150,150); //circle face
strokeWeight(8); //big point for make eye
point(75,70); //Right eye
point(120,70); //Left eye
strokeWeight(2);
fill(255);
arc(100,100,100,80,0,PI); //mouth
fill(255,231,41);
arc(100,100,100,60,0,PI); //mouth
// +++++++set of tooth left to right++++++
line(60,119,60,125);
line(70,123,70,131);
line(80,127,80,135);
line (90,129,90,139);
line(100,131,100,141);
line(110,129,110,139);
line(120,127,120,135);
line(130,123,130,131);
line(140,119,140,125);
}
void setup(){
size(200,200);
stroke(196,255,23); //background yellow
fill(196,255,23);
rect(0,0,20,200);
stroke(23,255,48); //background green
fill(23,255,48);
rect(20,0,20,200);
stroke(23,255,195); //background blue green
fill(23,255,195);
rect(40,0,20,200);
stroke(223,245,255); //background white
fill(223,245,255);
rect(60,0,20,200);
stroke(23,183,255); //background blue
fill(23,183,255);
rect(80,0,20,200);
stroke(23,83,255); //background hard blue
fill(23,83,255);
rect(100,0,20,200);
stroke(103,23,255); //background purple
fill(103,23,255);
rect(120,0,20,200);
stroke(161,23,255); //background hard purple
fill(161,23,255);
rect(140,0,20,200);
stroke(227,23,255); //background pink
fill(227,23,255);
rect(160,0,20,200);
stroke(255,23,201); //background hard pink
fill(225,23,201);
rect(180,0,20,200);
stroke(0);
strokeWeight(3);
fill(255,231,41);
ellipse(100,100,150,150); //circle face
strokeWeight(8); //big point for make eye
point(75,70); //Right eye
point(120,70); //Left eye
strokeWeight(2);
fill(255);
arc(100,100,100,80,0,PI); //mouth
fill(255,231,41);
arc(100,100,100,60,0,PI); //mouth
// +++++++set of tooth left to right++++++
line(60,119,60,125);
line(70,123,70,131);
line(80,127,80,135);
line (90,129,90,139);
line(100,131,100,141);
line(110,129,110,139);
line(120,127,120,135);
line(130,123,130,131);
line(140,119,140,125);
}
LAB 0 ชิ้นที่ 1
CODE
void setup(){
size(400,400);
background(255);
stroke(243,233,33);
fill(243,233,33);
rect(0,0,400,400,10); //background yellow
fill(7,7,144);
rect(30,30,340,340,10); //background blue
stroke(215,215,0);
fill(215,215,0);
quad(100,50,230,50,200,80,130,80); //top of L
quad(130,80,200,80,200,300,130,300); //body of L
quad(130,300,60,300,60,300,130,270); //left bottom Of L
quad(200,300,300,300,300,240,180,240); //right bottom part 1 only rect OF L
quad(300,300,350,200,350,190,300,240); //right bottom part2 OF L
stroke(255,255,0);
line(100,50,165,80); //line of light top left
line(230,50,165,80); //line of light top right
line(165,80,165,270); //line of light middle
line(60,300,165,270); //line of light bottom left
line(165,270,300,270); //line of light bottom middle right
line(300,270,350,190); //line of light bottom right
fill(0);
ellipse(30,30,40,40); //circle top left
}
void setup(){
size(400,400);
background(255);
stroke(243,233,33);
fill(243,233,33);
rect(0,0,400,400,10); //background yellow
fill(7,7,144);
rect(30,30,340,340,10); //background blue
stroke(215,215,0);
fill(215,215,0);
quad(100,50,230,50,200,80,130,80); //top of L
quad(130,80,200,80,200,300,130,300); //body of L
quad(130,300,60,300,60,300,130,270); //left bottom Of L
quad(200,300,300,300,300,240,180,240); //right bottom part 1 only rect OF L
quad(300,300,350,200,350,190,300,240); //right bottom part2 OF L
stroke(255,255,0);
line(100,50,165,80); //line of light top left
line(230,50,165,80); //line of light top right
line(165,80,165,270); //line of light middle
line(60,300,165,270); //line of light bottom left
line(165,270,300,270); //line of light bottom middle right
line(300,270,350,190); //line of light bottom right
fill(0);
ellipse(30,30,40,40); //circle top left
}
สมัครสมาชิก:
บทความ (Atom)


