31 สิงหาคม 2558

Lab3 Capt (interaction)

float move = 0;
float size_draw = 250;
float pos_x_shield = 370;
float speed;
color cl_star;
boolean start_fw;
boolean start_bw;

void setup() {
size(600, 600);
background(#0D0D0D);
start_fw=true;
speed=2;
}

void draw() {
draw_capt(move);
if (start_fw == true) {
move +=speed;
pos_x_shield +=speed;
if (pos_x_shield >= 475) {
start_fw = false;
start_bw = true;
}
}

if (start_bw == true) {
move -=speed;
pos_x_shield -=speed;
if (pos_x_shield <= 125) { start_fw = true; start_bw = false; } } cl_star= color(random(0, 255), random(0, 255), random(0, 255)); fill(255); textSize(13); text("speed "+speed, 20, 20); } void draw_capt(float pos_x) { background(#0D0D0D); noStroke(); fill(255); textSize(550); text("A", 100, 500);// A font fill(255); //----- title -----// textSize(30); text("CAPTAIN AMERICA", 162, 570); //----- Shield -----// fill(#EE0000); ellipse(pos_x_shield, 300, size_draw, size_draw); fill(255); ellipse(pos_x+370, 300, size_draw*0.84, size_draw*0.84); fill(#EE0000); ellipse(pos_x+370, 300, size_draw*0.68, size_draw*0.68); fill(#000080); ellipse(pos_x+370, 300, size_draw*0.52, size_draw*0.52); //----- Star -----// beginShape(); fill(cl_star); vertex(pos_x+370, 243); vertex(pos_x+382.5, 280.5); vertex(pos_x+420, 280.5); vertex(pos_x+395, 305.5); vertex(pos_x+407.5, 343); vertex(pos_x+370, 318); vertex(pos_x+332.5, 343); vertex(pos_x+345, 305.5); vertex(pos_x+320, 280.5); vertex(pos_x+357.5, 280.5); endShape(CLOSE); } void keyPressed() { if (keyCode==UP)speed+=0.5; if (keyCode==DOWN)speed-=0.5; if (speed<=2)speed=2; if (speed>=30)speed=30;
}





Lab3 Battery (interaction)



int size_draw = 200;
int percent_batt ;
void setup() {
size(500, 300);
background(0);
frameRate(30);
}

void draw() {
draw_batt(percent_batt);
if (key=='C'||key=='c') {
percent_batt++;
if (percent_batt<100) { fill(#43D551); textAlign(CENTER, CENTER); textSize(size_draw*0.2); text("Charge", width/2, (height/2)+(size_draw*0.43)); } if (percent_batt>=100) {
percent_batt=100;
}
}

if (key=='D'||key=='d') {
percent_batt--;
if (percent_batt>0) {
fill(#C32B2B);
textAlign(CENTER, CENTER);
textSize(size_draw*0.2);
text("Discharge", width/2, (height/2)-(size_draw*0.5));
}
if (percent_batt<=0) { percent_batt=0; } } } void draw_batt(int per_batt) { background(0); //-----Battery-----// rectMode(CENTER); strokeWeight(size_draw*0.02); stroke(#4A4A4A); noFill(); rect(width/2, height/2, size_draw, size_draw*0.6, size_draw*0.05);//Batery body rect((width/2)+(size_draw/2)+((size_draw*0.1)/2), height/2, size_draw*0.1, size_draw*0.2);//Battery terminal noStroke(); fill(#029AE9); rect((width/2)-(size_draw*0.7), height/2, size_draw*0.2, size_draw*0.1);//Negative terminal fill(#E10203); rect((width/2)+(size_draw*0.8), height/2, size_draw*0.2, size_draw*0.1);//Positive terminal rect((width/2)+(size_draw*0.8), height/2, size_draw*0.1, size_draw*0.2); //-----Energy battery-----// rectMode(CORNER); noStroke(); fill(#8EF608); rect((width/2)-((size_draw*0.9)/2), (height/2)-((size_draw*0.5)/2), ((size_draw*0.9)/100)*per_batt, size_draw*0.5, size_draw*0.02); //-----Percent charged-----// fill(#4A4A4A); textAlign(CENTER, CENTER); textSize(size_draw*0.2); text(per_batt+"%", width/2, (height/2)-(size_draw*0.025)); } void mousePressed() { if (mouseButton == LEFT) { size_draw+=5; } else if (mouseButton == RIGHT) { size_draw-=5; } }

Lab2 Syntax Error


Syntax error,maybe a missing semicolon?
ปัญหา : ไม่พบ semicolon " : "
แก้ไข : ใส่ semicolon หลังคำสั่งที่พบ


Syntax error,maybe a missing right parenthesis?
ปัญหา : ไม่พบวงเล็บปิด " ) "
แก้ไข : ใส่ วงเล็บปิด " ) " ตรงตำแหน่งที่พบ


Cannot find anything named "f"
ปัญหา : อาจเกิดจากเรียกใช้ ชื่อตัวแปร ผิด หรือไม่ได้ประกาศตัวแปรชื่อนั้นไว้
แก้ไข : เรียกใช้ชื่อตัวแปรให้ตรงที่กับประกาศไว้


The function draw_windo() does not exist
ปัญหา : ไม่พบฟังก์ชั่นที่เรียกใช้
แก้ไข : เรียกใช้ฟังก์ชั่นให้ตรงกับฟังก์ชั่นที่สร้างไว้


The method rect(float,float,float,float) in the type PApplet is not applicable for the arguments(int,int,int)
ปัญหา : ใส่ค่าลงในพารามิเตอร์ ไม่ครบตามจำนวนอาร์กิวเม้นท์ของฟังก์ชัน
แก้ไข : ใส่ค่าลงในพารามิเตอร์ ให้ครบตามจำนวนอาร์กิวเม้นท์ของฟังก์ชัน



Lab2 Digital Clock (Function)







void setup(){
size(250,250);
}

void draw(){
background(0);
clock_frame();
time();
date();
}

void time(){
fill(#A4A8CD);
textSize(20);
textAlign(CENTER);
text(nf(hour(), 2)+":"+nf(minute(), 2)+":"+nf(second(), 2), width/2, (height/2)-15);
}

void date(){
fill(#A4A8CD);
textSize(20);
textAlign(CENTER);
text(nf(day(), 2)+"/"+nf(month(), 2)+"/"+nf(year(), 2), width/2, (height/2)+15);
}

void clock_frame(){
rectMode(CENTER);
stroke(#05AAF5);
strokeWeight(5);
noFill();
rect(width/2,height/2-(5),150,100,15);
}

Lab2 Cal BMI (function)







void setup(){
size(250,100);
float bmi;
float weight_;
float height_;
//----- Define value -----//
weight_ = 68;
height_ = 174;

//----- Calculate -----//
bmi = cal_bmi(weight_,height_);

//----- Show Value ----//
fill(0);
textSize(12);
text("weight_ = "+weight_+" Kilograms",0,20);
text("height_ = "+height_+" Centimeters",0,40);
text("Body mass index(BMI) = "+bmi,0,60);
}

float cal_bmi(float w, float h){//Create function BMI calculation
float val_bmi = w/((h/100)*(h/100));//Formula of BMI
return val_bmi;
}

Lab2 Cal Circumference and Area (Function)







void setup(){
size(300,100);
float diameter;
float radius;
float circumference;
float area;

//----- Define value -----//
diameter = 30;
radius = diameter/2;

//----- Calculate -----//
circumference = cal_cir(radius);
area = cal_area(radius);

//----- Show Value ----//
fill(0);
textSize(12);
text("Diametermeter = "+diameter+" cm",0,10);
text("Radius = "+radius+" cm",0,30);
text("Circumferencecumference = "+circumference+" cm",0,50);
text("Area of circumferencecle = "+area+" cm2",0,70);
}

float cal_cir(float r){//Create function circumference calculation
float val_cir = PI*2*r;//Formula of circumference
return val_cir;
}

float cal_area(float r){//Create function area calculation
float val_area = PI*r*r;//Formula of circumferencecle area
return val_area;
}

Lab2 Martin (Function)







int move = 0;
int pos_x_martin = 0;
boolean start_fw;
boolean start_bw;

void setup(){
size (600,400);
background(0);
frameRate(30);
start_fw = true;
}

void draw(){
draw_martin(move);
move = (move+2)%width;
}

void draw_martin(int pos_x){
background(0);
//----- Frame -----//
noStroke();
rect(pos_x+60,+35,480,280,2); // Frame outside
fill(0);
rect(pos_x+100,+75,400,200,2);// Frame inside

//----- Positive Sign -----//
fill(255);
rect(pos_x+140,+155,140,40,2);
rect(pos_x+190,+105,40,140,2);

//----- X Sign -----//
quad(pos_x+349,+105,pos_x+460,+216,pos_x+431,+245,pos_x+320,+134);
quad(pos_x+431,+105,pos_x+460,+134,pos_x+349,+245,pos_x+320,+216);

//----- Tiltle -----//
fill(255);

textSize(52);
text("MAR", pos_x+65 , +365);
text("IN", pos_x+232 , +365);
text("GARRI", pos_x+313 , +365);

//----- Positive Sign Tiltle -----//
rect(pos_x+195,+341,36,10);
rect(pos_x+208,+328,10,36);
//----- X Sign Tiltle -----//
quad(pos_x+503,+328,pos_x+533,+358,pos_x+526,+365,pos_x+496,+335);
quad(pos_x+526,+328,pos_x+533,+335,pos_x+503,+365,pos_x+496,+358);
}

Lab2 Doraemon Book(Function)




int move = 0;
int pos_x_book = 100;
boolean start_fw;
boolean start_bw;

void setup() {
size(500, 500);
background(#F6B0D8);
frameRate(25);
start_fw = true;
}

void draw(){
draw_book(move);
if(start_fw == true){
move +=2;
pos_x_book +=2;
if(pos_x_book >= 200){
start_fw = false;
start_bw = true;
}
}

if(start_bw == true){
move -=2;
pos_x_book -=2;
if(pos_x_book <= 0){
start_fw = true;
start_bw = false;
}
}
}

void draw_book(int pos_x){
background(#F6B0D8);
strokeJoin(ROUND);
//----- front page -----//
strokeWeight(2);
fill(#323C5D);
rect(pos_x_book,100,270,340);

//----- behind doraemon background -----//
noStroke();
fill(#FCE314);
rect(pos_x+125,220,220,205);

//----- name book background -----//
fill(255);
rect(pos_x+125,130,220,50);
//----- name book -----//
fill(0);
textSize(35);
text("DORAEMON", pos_x+133, 167);

//----- book page -----//
strokeWeight(2);
stroke(0);
fill(255);
quad(pos_x+100,100,pos_x+130,80,pos_x+400,80,pos_x+370,100);
quad(pos_x+370,100,pos_x+400,80,pos_x+400,420,pos_x+370,440);
strokeWeight(1);
line(pos_x+106,96,pos_x+376,96);
line(pos_x+112,92,pos_x+382,92);
line(pos_x+118,88,pos_x+388,88);
line(pos_x+124,84,pos_x+394,84);
line(pos_x+376,96,pos_x+376,436);
line(pos_x+382,92,pos_x+382,432);
line(pos_x+388,88,pos_x+388,428);
line(pos_x+394,84,pos_x+394,424);

//----- Doraemon -----//
strokeWeight(3);
stroke(#325D87);
//----- face -----//
fill(#4F81BC);
ellipse(pos_x+235,320,200,175);
fill(255);
ellipse(pos_x+235,334,140,125);

//----- eyes -----//
fill(255);
ellipse(pos_x+215,274,37,50);
ellipse(pos_x+255,274,37,50);
fill(#325D87);
ellipse(pos_x+220,279,8,8);
strokeWeight(4);
arc(pos_x+248,281,6,6,PI,TWO_PI);
strokeWeight(3);

//----- nose -----//
fill(#FE0000);
ellipse(pos_x+235,301,20,20);

//----- mounth -----//
noFill();
arc(pos_x+235,350,100,50,0,PI);
line(pos_x+235,312,pos_x+235,375);

//----- Whiskers -----//
line(pos_x+220,320,pos_x+177,315);
line(pos_x+220,325,pos_x+175,325);
line(pos_x+220,330,pos_x+177,335);

line(pos_x+250,320,pos_x+293,315);
line(pos_x+250,325,pos_x+295,325);
line(pos_x+250,330,pos_x+293,335);

//----- collar -----//
fill(#FD0000);
rect(pos_x+185,395,100,13);

//----- bell -----//
fill(#FCBE0C);
ellipse(pos_x+235,394,20,20);

//----- hands -----//
fill(255);
ellipse(pos_x+180,395,30,28);
ellipse(pos_x+290,395,30,28);

}

Lab2 Capt (Function)

30 สิงหาคม 2558

Lab2 Battery Sign (function)







float move = 0;
float size_draw=80;

void setup(){
size(500,150);
background(0);
frameRate(60);
}

void draw(){
float end_point = width-(size_draw*0.6)-(width/2);
draw_batt(move);
move = (move+2)%width;
if (move>end_point) {
move=-end_point;
}
}

void draw_batt(float pos_x){
background(0);
//-----Battery-----//
rectMode(CENTER);
strokeWeight(size_draw*0.02);
stroke(#4A4A4A);
noFill();
rect(pos_x+width/2,height/2,size_draw,size_draw*0.6,size_draw*0.05);//Batery body
rect(pos_x+(width/2)+(size_draw/2)+((size_draw*0.1)/2),height/2,size_draw*0.1,size_draw*0.2);//Battery terminal
noStroke();
fill(#029AE9);
rect(pos_x+(width/2)-(size_draw*0.7),height/2,size_draw*0.2,size_draw*0.1);//Negative terminal
fill(#E10203);
rect(pos_x+(width/2)+(size_draw*0.8),height/2,size_draw*0.2,size_draw*0.1);//Positive terminal
rect(pos_x+(width/2)+(size_draw*0.8),height/2,size_draw*0.1,size_draw*0.2);

//-----Energy battery-----//
rectMode(CORNER);
noStroke();
fill(#8EF608);
rect(pos_x+(width/2)-((size_draw*0.9)/2),(height/2)-((size_draw*0.5)/2),size_draw*0.9,size_draw*0.5,size_draw*0.02);

}

void mousePressed() {
if (mouseButton == LEFT) {
size_draw+=5;
} else if (mouseButton == RIGHT){
size_draw-=5;
}
}

Lab2 Positive Sign (Function)







float move = 0;
float size_draw=80;

void setup() {
frameRate(30);
size(400, 200);
background(#FCFAD3);
rectMode(CENTER);
}

void draw() {
Positive_Sign(move);
float end_point = width-(size_draw*0.6)-(width/2);
move = (move+2)%width;
if (move>end_point) {
move=-end_point;
}
}



void Positive_Sign(float pos_x) {
//----- Circle 1 -----//
background(#FCFAD3);
noStroke();
fill(0);
ellipse(pos_x+width/2, height/2, size_draw*1.2, size_draw*1.2);

//----- Circle 2 -----//
stroke(#48494C);
strokeWeight((((size_draw*1.2)-size_draw)/2)*0.32);
ellipse(pos_x+width/2, height/2, size_draw*1.1, size_draw*1.1);

//----- Circle 3 -----//
noStroke();
fill(#FD3A3B);
ellipse(pos_x+width/2, height/2, size_draw, size_draw);

//----- Positive Sign -----//
fill(255);
rect(pos_x+width/2, height/2, size_draw*0.8, size_draw*0.2, size_draw*0.02); //Horizontal Rectangle
rect(pos_x+width/2, height/2, size_draw*0.2, size_draw*0.8, size_draw*0.02); //Vertical Rectangle
}

24 สิงหาคม 2558

Lab1 Calculate BMI







void setup(){
size(200,100);
float BMI;
float weight_;
float height_;
//----- Define value -----//
weight_ = 68;
height_ = 174;
//----- Formula of BMI -----//
BMI = weight_/((height_/100)*(height_/100));
println("Body mass index(BMI) = "+BMI);

fill(0);
textSize(12);
text("weight_ = "+weight_+" Kilograms",0,20);
text("height_ = "+height_+" Centimeters",0,40);
text("Body mass index(BMI) = "+BMI,0,60);
}

Lab1 Calculate Circumference and Area







void setup(){
size(300,100);
float circumference;
float diameter;
float radius;
float area;
//----- Define value -----//
diameter = 30;
radius = diameter/2;
//----- Formula of circumferencecumference -----//
circumference = PI*2*radius;
println("circumferencecumference = "+circumference);
//----- Formula of circumferencecle area -----//
area = PI*radius*radius;
println("area of circumferencecle = "+area);

fill(0);
textSize(12);
text("Diametermeter = "+diameter+" cm",0,10);
text("Radius = "+radius+" cm",0,30);
text("Circumferencecumference = "+circumference+" cm",0,50);
text("Area of circumferencecle = "+area+" cm2",0,70);

}

Lab1 Martin (Move)







void setup(){
int X = -35;
int Y = -20;
size (600,400);
background(0);
//----- Frame -----//
noStroke();
rect(X+60,Y+35,480,280,2); // Frame outside
fill(0);
rect(X+100,Y+75,400,200,2);// Frame inside

//----- Positive Sign -----//
fill(255);
rect(X+140,Y+155,140,40,2);
rect(X+190,Y+105,40,140,2);

//----- X Sign -----//
quad(X+349,Y+105,X+460,Y+216,X+431,Y+245,X+320,Y+134);
quad(X+431,Y+105,X+460,Y+134,X+349,Y+245,X+320,Y+216);

//----- Tiltle -----//
fill(255);
PFont font;
font = loadFont("Arial-Black-52.vlw");
textFont(font);
textSize(52);
text("MAR", X+65 , Y+365);
text("IN", X+232 , Y+365);
text("GARRI", X+313 , Y+365);

//----- Positive Sign Tiltle -----//
rect(X+195,Y+341,36,10);
rect(X+208,Y+328,10,36);
//----- X Sign Tiltle -----//
quad(X+503,Y+328,X+533,Y+358,X+526,Y+365,X+496,Y+335);
quad(X+526,Y+328,X+533,Y+335,X+503,Y+365,X+496,Y+358);
}

Lab1 Doraemon Book(Move)







void setup() {
int X = 0;
int Y = 0;
size(500, 500);
background(#F6B0D8);
strokeJoin(ROUND);
//----- front page -----//
strokeWeight(2);
fill(#323C5D);
rect(X+100,Y+100,270,340);

//----- behind doraemon background -----//
noStroke();
fill(#FCE314);
rect(X+125,Y+220,220,205);

//----- name book background -----//
fill(255);
rect(X+125,Y+130,220,50);
//----- name book -----//
fill(0);
textSize(35);
text("DORAEMON", X+133, Y+167);

//----- book page -----//
strokeWeight(2);
stroke(0);
fill(255);
quad(X+100,Y+100,X+130,Y+80,X+400,Y+80,X+370,Y+100);
quad(X+370,Y+100,X+400,Y+80,X+400,Y+420,X+370,Y+440);
strokeWeight(1);
line(X+106,Y+96,X+376,Y+96);
line(X+112,Y+92,X+382,Y+92);
line(X+118,Y+88,X+388,Y+88);
line(X+124,Y+84,X+394,Y+84);
line(X+376,Y+96,X+376,Y+436);
line(X+382,Y+92,X+382,Y+432);
line(X+388,Y+88,X+388,Y+428);
line(X+394,Y+84,X+394,Y+424);

//----- Doraemon -----//
strokeWeight(3);
stroke(#325D87);
//----- face -----//
fill(#4F81BC);
ellipse(X+235,Y+320,200,175);
fill(255);
ellipse(X+235,Y+334,140,125);

//----- eyes -----//
fill(255);
ellipse(X+215,Y+274,37,50);
ellipse(X+255,Y+274,37,50);
fill(#325D87);
ellipse(X+220,Y+279,8,8);
strokeWeight(4);
arc(X+248,Y+281,6,6,PI,TWO_PI);
strokeWeight(3);

//----- nose -----//
fill(#FE0000);
ellipse(X+235,Y+301,20,20);

//----- mounth -----//
noFill();
arc(X+235,Y+350,100,50,0,PI);
line(X+235,Y+312,X+235,Y+375);

//----- Whiskers -----//
line(X+220,Y+320,X+177,Y+315);
line(X+220,Y+325,X+175,Y+325);
line(X+220,Y+330,X+177,Y+335);

line(X+250,Y+320,X+293,Y+315);
line(X+250,Y+325,X+295,Y+325);
line(X+250,Y+330,X+293,Y+335);

//----- collar -----//
fill(#FD0000);
rect(X+185,Y+395,100,13);

//----- bell -----//
fill(#FCBE0C);
ellipse(X+235,Y+394,20,20);

//----- hands -----//
fill(255);
ellipse(X+180,Y+395,30,28);
ellipse(X+290,Y+395,30,28);

stroke(0);
strokeWeight(1);
line(0,250,500,250);
line(250,0,250,500);
}

23 สิงหาคม 2558

Lab1 Capt(Resize,Move)







void setup(){
int X = -50;
int Y = -50;
int Width = 0;
int Height = 0;
size(600,600);
background(#0D0D0D);
noStroke();
fill(255);
textSize(550);
text("A", X+100, Y+500);// A font
fill(255);

//----- title -----//
textSize(30);
text("CAPTAIN AMERICA", X+162, Y+570);

//----- Shield -----//
fill(#EE0000);
ellipse(X+370,Y+300,Width+250,Height+250);
fill(255);
ellipse(X+370,Y+300,Width+210,Height+210);
fill(#EE0000);
ellipse(X+370,Y+300,Width+170,Height+170);
fill(#000080);
ellipse(X+370,Y+300,Width+130,Height+130);

//----- Star -----//
beginShape();
fill(255);
vertex(X+370,Y+243);
vertex(X+382.5 , Y+280.5);
vertex(X+420 , Y+280.5);
vertex(X+395 , Y+305.5);
vertex(X+407.5 , Y+343);
vertex(X+370 , Y+318);
vertex(X+332.5 , Y+343);
vertex(X+345 , Y+305.5);
vertex(X+320 , Y+280.5);
vertex(X+357.5 , Y+280.5);
endShape(CLOSE);

stroke(255);
strokeWeight(1);
line(0,300,600,300);
line(300,0,300,600);

}

Lab1 Battery Sign (Resize,Move)








void setup() {
int pos_x_batt = 100;//default = 0;
int pos_y_batt = 100;//default = 0;
float batt_w = 50;
float batt_h = batt_w*1.92;
float batt_terminal_w = batt_w/2.5;
float batt_terminal_h = batt_h/9.6;
float en_batt_w = batt_w*0.8;
float en_batt_h = batt_h/8.347;
float slot = batt_h*0.036453;

size(500,500);
background(0);

//----- Battery -----//
stroke(#34F707);
strokeWeight(batt_w*0.05);
fill(0);
rect(pos_x_batt , pos_y_batt , batt_w , batt_h ); //Battery body
rect((pos_x_batt+(batt_w/2))-(batt_terminal_w/2) , pos_y_batt-batt_terminal_h , batt_terminal_w , batt_terminal_h); //Batter terminal

//-----Energy Battery -----//
noStroke();
fill(#00FE00);
rect((pos_x_batt+(batt_w/2)-(en_batt_w/2)),(pos_x_batt+(batt_w/2)-(en_batt_w/2)),en_batt_w,en_batt_h);
fill(#A3FC00);
rect((pos_x_batt+(batt_w/2)-(en_batt_w/2)),(pos_x_batt+(batt_w/2)-(en_batt_w/2))+en_batt_h+slot,en_batt_w,en_batt_h);
fill(#F3FC00);
rect((pos_x_batt+(batt_w/2)-(en_batt_w/2)),(pos_x_batt+(batt_w/2)-(en_batt_w/2))+(en_batt_h*2)+(slot*2),en_batt_w,en_batt_h);
fill(#FBAD00);
rect((pos_x_batt+(batt_w/2)-(en_batt_w/2)),(pos_x_batt+(batt_w/2)-(en_batt_w/2))+(en_batt_h*3)+(slot*3),en_batt_w,en_batt_h);
fill(#FD6A00);
rect((pos_x_batt+(batt_w/2)-(en_batt_w/2)),(pos_x_batt+(batt_w/2)-(en_batt_w/2))+(en_batt_h*4)+(slot*4),en_batt_w,en_batt_h);
fill(#FA002A);
rect((pos_x_batt+(batt_w/2)-(en_batt_w/2)),(pos_x_batt+(batt_w/2)-(en_batt_w/2))+(en_batt_h*5)+(slot*5),en_batt_w,en_batt_h);

strokeWeight(0.5);
stroke(255);
line(0,height/2,width,height/2);
line(width/2,0,width/2,height);

}

Lab1 Positive Sign (Resize,Move)







void setup(){
int pos_x = -50;//center default = 0
int pos_y = -50;//center default = 0
float size_draw=150;

size(500,500);
background(#FCFAD3);
rectMode(CENTER);

//----- Circle 1 -----//
noStroke();
fill(0);
ellipse(pos_x+width/2 , pos_y+height/2 , size_draw*1.2 , size_draw*1.2);

//----- Circle 2 -----//
stroke(#48494C);
strokeWeight((((size_draw*1.2)-size_draw)/2)*0.32);
ellipse(pos_x+width/2 , pos_y+height/2 , size_draw*1.1 , size_draw*1.1);

//----- Circle 3 -----//
noStroke();
fill(#FD3A3B);
ellipse(pos_x+width/2 , pos_y+height/2 , size_draw , size_draw);

//----- Positive Sign -----//
fill(255);
rect(pos_x+width/2,pos_y+height/2,size_draw*0.8,size_draw*0.2,size_draw*0.02); //Horizontal Rectangle
rect(pos_x+width/2,pos_y+height/2,size_draw*0.2,size_draw*0.8,size_draw*0.02); //Vertical Rectangle


strokeWeight(0.5);
stroke(0);
line(0,height/2,width,height/2);
line(width/2,0,width/2,height);
fill(0);
ellipse(pos_x+width/2,pos_y+height/2,2,2);

}

Lab0 Martin







void setup(){
size (600,400);
background(0);
//----- Frame -----//
noStroke();
rect(60,35,480,280,2); // Frame outside
fill(0);
rect(100,75,400,200,2);// Frame inside

//----- Positive Sign -----//
fill(255);
rect(140,155,140,40,2);
rect(190,105,40,140,2);

//----- X Sign -----//
quad(349,105,460,216,431,245,320,134);
quad(431,105,460,134,349,245,320,216);

//----- Tiltle -----//
fill(255);
PFont font;
font = loadFont("Arial-Black-52.vlw");
textFont(font);
text("MAR", 65 ,365);
text("IN", 232 ,365);
text("GARRI", 313 ,365);

//----- Positive Sign Tiltle -----//
rect(195,341,36,10);
rect(208,328,10,36);
//----- X Sign Tiltle -----//
quad(503,328,533,358,526,365,496,335);
quad(526,328,533,335,503,365,496,358);

}

17 สิงหาคม 2558

Lab0 Doraemon Book







void setup() {
size(500, 500);
background(#F6B0D8);
strokeJoin(ROUND);
//----- front page -----//
strokeWeight(2);
fill(#323C5D);
rect(100,100,270,340);

//----- behind doraemon background -----//
noStroke();
fill(#FCE314);
rect(125,220,220,205);

//----- name book background -----//
fill(255);
rect(125,130,220,50);
//----- name book -----//
fill(0);
textSize(35);
text("DORAEMON", 133, 167);

//----- book page -----//
strokeWeight(2);
stroke(0);
fill(255);
quad(100,100,130,80,400,80,370,100);
quad(370,100,400,80,400,420,370,440);
strokeWeight(1);
line(106,96,376,96);
line(112,92,382,92);
line(118,88,388,88);
line(124,84,394,84);
line(376,96,376,436);
line(382,92,382,432);
line(388,88,388,428);
line(394,84,394,424);

//----- Doraemon -----//
strokeWeight(3);
stroke(#325D87);
//----- face -----//
fill(#4F81BC);
ellipse(235,320,200,175);
fill(255);
ellipse(235,334,140,125);

//----- eyes -----//
fill(255);
ellipse(215,274,37,50);
ellipse(255,274,37,50);
fill(#325D87);
ellipse(220,279,8,8);
strokeWeight(4);
arc(248,281,6,6,PI,TWO_PI);
strokeWeight(3);

//----- nose -----//
fill(#FE0000);
ellipse(235,301,20,20);

//----- mounth -----//
noFill();
arc(235,350,100,50,0,PI);
line(235,312,235,375);

//----- Whiskers -----//
line(220,320,177,315);
line(220,325,175,325);
line(220,330,177,335);

line(250,320,293,315);
line(250,325,295,325);
line(250,330,293,335);

//----- collar -----//
fill(#FD0000);
rect(185,395,100,13);

//----- bell -----//
fill(#FCBE0C);
ellipse(235,394,20,20);

//----- hands -----//
fill(255);
ellipse(180,395,30,28);
ellipse(290,395,30,28);

}

16 สิงหาคม 2558

Lab0 Capt







void setup(){
size(600,600);
background(#0D0D0D);
noStroke();
fill(255);
textSize(550);
text("A", 100, 500);
fill(255);

//title
textSize(30);
text("CAPTAIN AMERICA", 162, 570);

//Shield
fill(#EE0000);
ellipse(370,300,250,250);
fill(255);
ellipse(370,300,210,210);
fill(#EE0000);
ellipse(370,300,170,170);
fill(#000080);
ellipse(370,300,130,130);

//Star
beginShape();
fill(255);
vertex(370,243);
vertex(382.5 , 280.5);
vertex(420 , 280.5);
vertex(395 , 305.5);
vertex(407.5 , 343);
vertex(370 , 318);
vertex(332.5 , 343);
vertex(345 , 305.5);
vertex(320 , 280.5);
vertex(357.5 , 280.5);
endShape(CLOSE);

}

14 สิงหาคม 2558

Lab0 PinkCat





void setup()
{
size (500,500); //dimension of the display window width and height = 500*500 pixel
background(#FFB5C5); //pink
strokeWeight(8);

//face
noFill();
ellipse(250,250,270,250);

//ear
line(131,190,115,105);
line(115,105,210,128);
line(369,190,385,105);
line(385,105,290,128);

//eyes
fill(0); //black
ellipse(190,240,30,65);
ellipse(310,240,30,65);

//nose
strokeWeight(8);
line(230,290,270,290);
line(272,291,250,310);
line(250,310,228,291);

//mounth
noFill();
arc(229,315,40,40,0, PI/2+QUARTER_PI);
arc(271,315,40,40,QUARTER_PI, PI);

//Whiskers
strokeWeight(4);
line(165,290,200,300);
line(165,305,200,305);
line(165,320,200,310);

line(335,290,300,300);
line(335,305,300,305);
line(335,320,300,310);
}