//week14_1_PFont
size(300,300);
textSize(50);//50號字
text("Hello",10,50);//預設字型
PFont font = createFont("Times New Roman",50);
textFont(font);
text("Hello",10,100);//放下面一點
print(PFont.list());//列出現在所有可用字型
PFont font1,font2;
void setup(){
size(300,300);
font1=createFont("Times New Roman Bold Italic",50);
font2= createFont("微軟正黑體 Bold",50);
}
void draw(){
background(0);//黑色背景
cursor(CROSS);
fill(255); //預設是白色的填充色
textFont(font1);
text("Hello 中文",mouseX+20,mouseY-20);
fill(#FF8E8E);//tool-color
textFont(font2);
text("Hello 中文",mouseX+20,mouseY+50);//下面一點
}
//week14_3_ik_inverse
void setup(){
size(400,400);
}
float [] angle=new float[5];
void draw(){
background(255);
translate(200,350);
ellipse(0,0,12,12);
pushMatrix();
rotate(radians(angle[0]));
rect(0,-5,50,10);
pushMatrix();
translate(50,0);
rotate(radians(angle[1]));
rect(0,-5,50,10);
popMatrix();
popMatrix();
}
void mouseDragged(){
angle[ID] += mouseX-pmouseY;
}
int ID =0;
void keyPressed(){
if(key=='0') ID=0;
if(key=='1') ID=1;
}
沒有留言:
張貼留言