float
pound = 1;
println(pound*0.45359237,"kilogram");
วันจันทร์ที่ 18 สิงหาคม พ.ศ. 2557
Lab 1 - Task#5 : volume of a cylinder
float
radius = 1, //meter
Height = 1; //meter
println(3.14159265358979323846264338327950288419716939937510*(radius*radius)*Height,"square meter");
radius = 1, //meter
Height = 1; //meter
println(3.14159265358979323846264338327950288419716939937510*(radius*radius)*Height,"square meter");
Lab 1 - Task#3 : Soccer Field
void draw()
{
size(350, 250);
background(100,150,0);
draw_line(75,75);
int x,y;
x=20;
y=20;
noStroke();
fill(255);
ellipse(mouseX,mouseY,x,y)
}
void draw_line(int x,int y)
{
stroke(255);
strokeWeight(5);
noFill();
rect(2, 2, width-5, height-5);
ellipse(width/2, height/2, x, y);
line(width/2, 0, width/2, height);
rect(0, y/2, x, height-y);
rect(0, height/2-y/2, x/2, y);
rect(width-x, y/2, x, height-y);
rect(width-(x/2), height/2-y/2, x/2, y);
}
Lab 1 - Task#2 : Spoon & Fork
void setup()
{
size(201,201);
background(157);
for(int i=0; i<201; i=i+10)
{
line(0,i,200,i);
line(i,0,i,200);
}
}
void draw()
{
int px,py,fix_x,fix_y;
fix_x = (mouseX%10);
fix_y = (mouseY%10);
px = mouseX-fix_x;
py = mouseY-fix_y;
background(157);
noStroke();
//BG
fill(50);
rect(px-70,py-70,150,160);
fill(100);
rect(px-60,py-60,130,140);
//dark
fill(35);
//spoon
rect(px-40,py-50,30,60);
rect(px-50,py-40,50,40);
rect(px-30,py+10,10,50);
rect(px-40,py+40,30,30);
//fork
rect(px+10,py-50,10,60);
rect(px+30,py-50,10,90);
rect(px+50,py-50,10,60);
rect(px+10,py-20,50,30);
rect(px+20,py+40,30,30);
//light fill(200);
//spoon
rect(px-40,py-40,30,40);
rect(px-30,py+50,10,10);
//fork
rect(px+20,py-10,30,10);
rect(px+30,py+50,10,10);
//grid
stroke(0);
for(int i=0; i<201; i=i+10)
{
line(0,i,200,i);
line(i,0,i,200);
}
}
Lab 1 - Task#1 : Star
void setup()
{
size(200,200);
background(0);
int r,i,o,p;
float x,y;
p=80*4;
r=89*4;
i=0;
o=0;
//gra
while(o<40)
{
fill(255+o,160+o*1.4,0+o);
noStroke();
ellipse(100,100,(r/2)-o*4-7,(r/2)-o*4-7);
o=o+1;
}
noFill();
stroke(0);
strokeWeight(5);
//ell
while(i<5)
{
x=100+p*cos(HALF_PI+i*TWO_PI/5);
y=100+p*sin(HALF_PI+i*TWO_PI/5);
ellipse(x,y,r*2,r*2);
i=i+1;
}
}
สมัครสมาชิก:
บทความ (Atom)