วันพุธที่ 27 สิงหาคม พ.ศ. 2557
star anime
void setup() {
size(323, 200);
background(200,0,0);
frameRate(200);
}
float y = 100;
void draw()
{
background(0); // Set the background to black
y = y - 1;
if (y < -166) { y = width; }
int center_star = 166 ;
noStroke ();
fill (#FFCC00);
triangle(center_star+y, 50, center_star+y, center_star-61, center_star-36+y, center_star-41); //triangle1
triangle(center_star+y, center_star-116, center_star+y, 105, center_star+36+y, center_star-41); //triangle2
triangle(center_star-46+y, center_star-91, center_star+y, center_star-61, center_star+44+y, center_star-91); //triangle3
}
วันอังคารที่ 26 สิงหาคม พ.ศ. 2557
Lab1 : Convert pounds into kilograms
{ void setup() {
float pounds = 100;
float kilograms = 0;
kilograms = (pounds/2.2046);
println(kilograms);
}
Lab1 : Convert Celsius to Fahrenheit
void setup() {
float Celsius = 100;
float Fahrenheit = 0;
Fahrenheit = (Celsius*9)/5 + 32;
println(Fahrenheit);
}
Lab1 : Compute the volume of a cylinder
void setup() {
float height = 100;
float radius = 20 ;
float volume = 0;
float Pi = 3.1415 ;
volume = (Pi*radius*radius*height);
println(volume);
}
Lab1 : Convert feet into meters
void setup() {
float feet = 10;
float meters = 0;
meters = feet*0.3048;
println(meters); }
วันจันทร์ที่ 25 สิงหาคม พ.ศ. 2557
วันเสาร์ที่ 23 สิงหาคม พ.ศ. 2557
Lab1 : draw a football (soccer) field
void setup() {
size(323, 200);
background(#2EB82E);
fill(#2EB82E);
strokeWeight(3);
int center_filedX = 162.5 ;
int center_filedY = 100 ;
int radius_center_circle = 40
quad(center_filedX-137.5,center_filedY-80,center_filedX-137.5,center_filedY+80,center_filedX+137.5,center_filedY+80,
center_filedX+137.5,center_filedY-80) ; //field
ellipse(center_filedX,center_filedY,radius_center_circle,
radius_center_circle) ; //center circle
line(center_filedX,center_filedY-80,center_filedX,center_filedY+80) ; //half way line
//left court
int corner_filedX = 25 ;
int corner_filedY = 50 ;
quad(corner_filedX,corner_filedY,corner_filedX,
corner_filedY+100,corner_filedX+45,corner_filedY+100,
corner_filedX+45,corner_filedY) ; //penalty area
quad(corner_filedX,corner_filedY+20,corner_filedX,
corner_filedY+80,corner_filedX+25,corner_filedY+80,
corner_filedX+25,corner_filedY+20) ; //penalty area
quad(corner_filedX,corner_filedY+35,corner_filedX,
corner_filedY+65,corner_filedX-10,corner_filedY+65,corner_filedX-10,corner_filedY+35) ; //goal
arc(corner_filedX, corner_filedY-30, corner_filedX-10,
corner_filedY-35, 0, PI/2) ; //top corner
arc(corner_filedX, corner_filedY+130, corner_filedX-10, corner_filedY-35, TWO_PI-PI/2, TWO_PI
) ; //buttom corner
arc(corner_filedX+48,corner_filedY+50,corner_filedX-5,corner_filedY, -PI/2,PI/2);
//right court
int corner_filedX = 300 ;
int corner_filedY = 50 ;
quad(corner_filedX,corner_filedY+100,corner_filedX,corner_filedY,
corner_filedX-45,corner_filedY,corner_filedX-45,corner_filedY+100) ; //penalty area
quad(corner_filedX,corner_filedY+20,corner_filedX,
corner_filedY+80,corner_filedX-25,corner_filedY+80,corner_filedX-25,corner_filedY+20) ; //penalty area
quad(corner_filedX,corner_filedY+35,corner_filedX,corner_filedY+65,
corner_filedX+10,corner_filedY+65,corner_filedX+10,corner_filedY+35) ; //goal
arc(corner_filedX, corner_filedY-30, corner_filedX-285,corner_filedY-35, PI/2,PI) ; //top corner
arc(corner_filedX, corner_filedY+130, corner_filedX-285, corner_filedY-35, PI, TWO_PI-PI/2) ; //buttom corner
arc(corner_filedX-47,corner_filedY+50,corner_filedX-280,corner_filedY
, PI/2,TWO_PI-PI/2);
}
Lab1 : draw spoon and fork
void setup() {
size(400, 400);
background(255,229,204);
int fork1_X = 120 ;
int fork1_Y = 155 ;
int fork_width = 10 ;
int fork_height = 50 ;
int fork_radius = 5 ;
fill(160, 160, 160);
noStroke();
rect( fork1_X, fork1_Y, fork_width+5, fork_height+30, fork_radius) ; //part of fork1
rect( fork1_X-20, fork1_Y-55, fork_width, fork_height) ; //part of fork2
rect( fork1_X-5, fork1_Y-55, fork_width, fork_height) ; //part of fork3
rect( fork1_X+10, fork1_Y-55, fork_width, fork_height) ; //part of fork4
rect( fork1_X+25, fork1_Y-55, fork_width, fork_height) ; //part of fork5
rect( fork1_X-20, fork1_Y-10, fork_width+45, fork_height-25, fork_radius) ; //part of fork6
int spoon1_X = 220 ;
int spoon1_Y = 155 ;
int width_spoon = 40 ;
int height_spoon = 60 ;
rect( spoon1_X, spoon1_Y, spoon1_Y-140, 2*width_spoon, height_spoon-55) ; //part of spoon1
ellipse( spoon1_X+5, spoon1_Y-20, width_spoon+10, height_spoon+15) ; //part of spoon2
fill( 126, 126, 126);
ellipse( spoon1_X+5, spoon1_Y-20, width_spoon, height_spoon) ; //part of spoon3
}
Lab1 : star
void setup() {
size(400, 400);
background(#000000);
int top_point_starX = 166 ;
int top_point_starY = 50 ;
int circle_smallX = 300 ;
int circle_smallY = 450 ;
int circle_radius = 250 ;
noStroke() ;
fill(206,206,206);
triangle( top_point_starX, top_point_starY-20, top_point_starX, top_point_starY+75, top_point_starX-56, top_point_starY+95) ; //part1 of star1
triangle( top_point_starX, top_point_starY-20, top_point_starX, top_point_starY+75, top_point_starX+56, top_point_starY+95) ; //part2 of star1
triangle( top_point_starX-66, top_point_starY+18, top_point_starX, top_point_starY+75, top_point_starX+64, top_point_starY+18) ; //part3 of star1
fill(206,116,229);
triangle( top_point_starX, top_point_starY-10, top_point_starX, top_point_starY+65, top_point_starX-46, top_point_starY+85) ; //part1 of star2
triangle( top_point_starX, top_point_starY-10, top_point_starX, top_point_starY+65, top_point_starX+46, top_point_starY+85) ; //part2 of star2
triangle( top_point_starX-56, top_point_starY+21, top_point_starX, top_point_starY+65, top_point_starX+54, top_point_starY+21) ; //part3 of star2
fill(255); triangle( top_point_starX, top_point_starY, top_point_starX, top_point_starY+55, top_point_starX-36, top_point_starY+75) ; //part1 of star3
triangle( top_point_starX, top_point_starY, top_point_starX, top_point_starY+55, top_point_starX+36, top_point_starY+75) ; //part2 of star3
triangle( top_point_starX-46, top_point_starY+25, top_point_starX, top_point_starY+55, top_point_starX+44, top_point_starY+25) ; //part3 of star3
fill(255,0,0);
ellipse(circle_smallX,circle_smallY,circle_radius+150,circle_radius+150) ; //circle red
fill(255,255,0);
ellipse(circle_smallX,circle_smallY,circle_radius+100,circle_radius+100) ; //circle yellow
fill(0,153,76);
ellipse(circle_smallX,circle_smallY,circle_radius+50,circle_radius+50) ; // circle green
fill(0,0,102);
ellipse(circle_smallX,circle_smallY,circle_radius,circle_radius) ; //circle blue
fill(51,0,102); ellipse(circle_smallX,circle_smallY,circle_radius-50,circle_radius-50) ; //circle dark blue
fill(102,0,102);
ellipse(circle_smallX,circle_smallY,circle_radius-100,circle_radius-100) ; //circle purple
}
Lab1 : my hope and dream
void setup() {
size(323, 200);
background(#FFFFFF);
int pointRightX_body = 176 ;
int pointTopY_body = 127 ;
float centerX_flash = 127.5 ;
int centerY_flash = 118 ;
int size_partCamera = 20 ;
fill(#333333);
quad(pointRightX_body, pointTopY_body, pointRightX_body-98, pointTopY_body, pointRightX_body-98, pointTopY_body+42, pointRightX_body, pointTopY_body+42); //gray body
fill(#6699FF);
quad(pointRightX_body, pointTopY_body, pointRightX_body-98, pointTopY_body, pointRightX_body-98, pointTopY_body-19, pointRightX_body, pointTopY_body-19); //blue body
fill(#000000);
rect(pointRightX_body-67, pointTopY_body+1, pointRightX_body-141, pointTopY_body-87); // black body
fill(#6699FF);
rect(pointRightX_body-63.5, pointTopY_body-22.5, size_partCamera+8, size_partCamera+8); //blue flash
fill(#000000);
rect(pointRightX_body-59.5, pointTopY_body-18.5, size_partCamera, size_partCamera); //black flash
fill(#FFFFFF);
ellipse(centerX_flash, centerY_flash, size_partCamera-7, size_partCamera-7); //flash
fill(#999999);
ellipse(centerX_flash, centerY_flash+32, size_partCamera+5, size_partCamera+5); //gray camera2
fill(#999999);
ellipse(centerX_flash, centerY_flash+32, size_partCamera-5, size_partCamera-5); //gray camera1
fill(#000000);
rect(pointRightX_body-99, pointTopY_body-22.5, size_partCamera-5, size_partCamera-10); //button
fill(#000000);
ellipse(centerX_flash-72.5, centerY_flash+47, size_partCamera+5, size_partCamera-15); //camera cover
fill(#333333);
rect(pointRightX_body-134, pointTopY_body+38, size_partCamera+5, size_partCamera-15); //camera cover
int photo_purpleX = 185 ;
int photo_purpleY = 65 ;
int photo_width = 35 ;
int photo_height = 40 ;
fill(#CC33FF);
rect(photo_purpleX, photo_purpleY, photo_width, photo_height); //photo purple
fill(#FF99FF);
rect(photo_purpleX+48, photo_purpleY+10, photo_width, photo_height); //photo pink
fill(#FFCC99);
rect(photo_purpleX+18, photo_purpleY+40, photo_width, photo_height); //photo cream
}
Lab1 : favourite subject/topic
void setup() {
size(323, 200);
background(#E2FFAA);
int vertext_triangleX = 138;
int vertext_triangleY = 180;
int point_brandX = 153;
int point_brandY = 145;
int center_icecreamX = 138;
int center_icecreamY = 115;
int radius_icecream = 25;
int line_cherryX = 138;
int line_cherrry = 70;
strokeWeight(2);
stroke(#E69C53);
fill(#FFAD5C);
triangle(vertext_triangleX-28, vertext_triangleY-65, vertext_triangleX, vertext_triangleY, vertext_triangleX+28, vertext_triangleY-65); //cone
fill(#24248F);
quad(point_brandX, point_brandY, point_brandX-31, point_brandY, point_brandX-23, point_brandY+18, point_brandX-7, point_brandY+18); //brand
strokeWeight(2);
stroke(#E69C53);
fill(#FFAD5C);
ellipse(center_icecreamX, center_icecreamY, center_icecreamX-88, center_icecreamY-90); //cone
strokeWeight(2);
stroke(#FFBFBF);
fill(#FFB8B8);
ellipse(center_icecreamX, center_icecreamY-10, 2*radius_icecream, 2*radius_icecream); //ice-cream
strokeWeight(2);
stroke(#FF0000);
fill(#FF0000);
ellipse(center_icecreamX, center_icecreamY-35, radius_icecream-5, radius_icecream-5); //cherry
line(line_cherryX, line_cherrry, line_cherryX+12, line_cherrry-20); //cherry
fill(255);
rect(rectX,rectY,weight_rect,weight_rect);
rect(rectX+20,rectY-20,weight_rect,weight_rect); rect(rectX+30,rectY+5,weight_rect,weight_rect);
}
Lab1 : dreaw a tree
void setup() {
size(323, 200);
background(#FFFF99);
int center_treeX = 135 ;
int center_treeY = 121.5 ;
fill(#000000);
quad(center_treeX+53, center_treeY+9.5, center_treeX-57, center_treeY+9.5, center_treeX-33, center_treeY+3.5, center_treeX+29, center_treeY+3.5); //black soil
noFill();
fill(#8A5C00);
quad(center_treeX-30, center_treeY-41.5, center_treeX+30, center_treeY-41.5, center_treeX+30, center_treeY+41.5, center_treeX-30, center_treeX+41.5); //brown tree
fill(#A3C2C2);
quad(center_treeX+53, center_treeY+9.5, center_treeX-57, center_treeY+9.5, center_treeX-33, center_treeY+51.5, center_treeX+29, center_treeY+51.5); //blue pots
noFill();
int center_leavesX = 135 ;
int center_leavesY = 121.5 ;
int radius_leaves = 40 ;
fill(#19A319);
noStroke();
ellipse(center_leavesX-35, center_leavesY-31.5, radius_leaves, radius_leaves); //green leaves1
ellipse(center_leavesX-50, center_leavesY-56.5, radius_leaves, radius_leaves); //green leaves2
ellipse(center_leavesX-30, center_leavesY-71.5, radius_leaves, radius_leaves); //green leaves3
ellipse(center_leavesX+18, center_leavesY-76.5, radius_leaves-10, radius_leaves); //green leaves4
ellipse(center_leavesX+50, center_leavesY-46.5, radius_leaves, radius_leaves); //green leaves5
ellipse(center_leavesX+40, center_leavesY-61.5, radius_leaves, radius_leaves); //green leaves6
ellipse(center_leavesX+40, center_leavesY-31.5, radius_leaves-10, radius_leaves); //green leaves7
ellipse(center_leavesX+5, center_leavesY-58.5, radius_leaves+50, radius_leaves+25); //green leaves8
}
วันเสาร์ที่ 16 สิงหาคม พ.ศ. 2557
LabO : draw about my hope and dream
void setup() {
size(323, 200);
background(#FFFFFF);
fill(#333333);
quad(176, 127, 78, 127, 78, 169, 176, 169); //gray body
noFill();
fill(#6699FF);
quad(176, 127, 78, 127, 78, 108, 176, 108); //blue body
noFill();
fill(#000000);
rect(109, 128, 35, 40); // black body
fill(#6699FF);
rect(112.5, 104.5, 28, 28); //blue flash
fill(#000000);
rect(116.5, 107.5, 20, 20); //black flash
fill(#FFFFFF);
ellipse(127.5, 118, 13, 13); //flash
fill(#999999);
ellipse(127.5, 150, 25, 25); //gray camera2
fill(#999999);
ellipse(127.5, 150, 15, 15); //gray camera1
fill(#000000);
rect(77, 104.5, 15, 10); //buttom
fill(#000000);
ellipse(55, 165, 25, 5); //camera cover
fill(#333333);
rect(42, 165, 25, 5); //camera cover
fill(#CC33FF);
rect(185, 65, 35, 40); //photo purple
fill(#FF99FF);
rect(233, 75, 35, 40); //photo pink
fill(#FFCC99);
rect(203, 105, 35, 40); //photo cream
}
วันศุกร์ที่ 15 สิงหาคม พ.ศ. 2557
LabO : draw about my favourite subject/topic
void setup() {
size(323, 200);
background(#E2FFAA);
strokeWeight(2);
stroke(#E69C53);
fill(#FFAD5C);
triangle(110, 115, 138, 180, 166, 115); //cone
fill(#24248F);
quad(153, 145, 122, 145, 130, 163, 146, 163); //brand
strokeWeight(2);
stroke(#E69C53);
fill(#FFAD5C);
ellipse(138, 115, 50, 25); //cone
strokeWeight(2);
stroke(#FFBFBF);
fill(#FFB8B8);
ellipse(138, 105, 50, 50); //ice-cream
strokeWeight(2);
stroke(#FF0000);
fill(#FF0000);
ellipse(138, 80, 20, 20); //cherry
line(138, 70, 150, 50); //cherry
}
วันพฤหัสบดีที่ 14 สิงหาคม พ.ศ. 2557
LabO : draw a tree
void setup() {
size(323, 200);
background(#FFFF99);
fill(#000000);
quad(188, 131, 78, 131, 102, 125, 164, 125); //black soil
noFill();
fill(#8A5C00);
quad(105, 80, 165, 80, 165, 163, 105, 163); //brown tree
fill(#A3C2C2);
quad(188, 131, 78, 131, 102, 173, 164, 173); //blue pots
noFill();
fill(#19A319);
noStroke();
ellipse(100, 90, 40, 40); //green leaves1
ellipse(85, 65, 40, 40); //green leaves2
ellipse(105, 50, 40, 40); //green leaves3
ellipse(153, 45, 30, 40); //green leaves4
ellipse(185, 75, 40, 40); //green leaves5
ellipse(175, 60, 40, 40); //green leaves6
ellipse(175, 90, 30, 40); //green leaves7
ellipse(140, 63, 90, 65); //green leaves8
}
วันพุธที่ 13 สิงหาคม พ.ศ. 2557
สมัครสมาชิก:
บทความ (Atom)