int sty; int alpha=255; int dx=1; void setup() { size (400, 500); textSize(30); } void draw() { background(0); if (frameCount%120>=60) { sty=1; } else { sty=0; } keroro(0, 0, width, height, sty); } void keroro(int x, int y, int w, int h, int style) { //book strokeWeight(3); fill(#1ED36E); rect(x, y, w, h); //face fill(255); rect(x, y, w, h*3/4); //yellow cap fill(#F5FF6A); rect(x, y, w, h*0.125); //star fill(#F50529); noStroke(); quad(x+w*0.5, y, x+w*0.55, y+h*0.1, x+w*0.5, y+h*0.075, x+w*0.45, y+h*0.1); triangle(x+w*0.42, y+h*0.0375, x+w*0.58, y+h*0.0375, x+w*0.5, y+h*0.075); //green face stroke(0); strokeWeight(3); fill(#33AF47); rect(x, y+h*0.125, w, h*0.46); //white arc fill(255); arc(x+w*0.5, y+h*0.725, w*1.4, h*0.375, QUARTER_PI+PI, 2*PI-QUARTER_PI); //mouth + eye if (style==0) { fill(#FA7474); arc(x+w*0.5, y+h*0.54, w*0.25, h*0.125, 0, PI); //eye fill(255); ellipse(x+w*0.23, y+h*0.35, w/3, h/4); fill(0); ellipse(x+w*0.23, y+h*0.35, w/6, h/8); fill(255); ellipse(x+w*0.77, y+h*0.35, w/3, h/4); fill(0); ellipse(x+w*0.77, y+h*0.35, w/6, h/8); } else { fill(#FA7474); arc(x+w*0.5, y+h*0.54, w*0.15, h*0.21, 0, PI); //eye fill(255); ellipse(x+w*0.23, y+h*0.35, w/3, h/4); fill(0); line(x+w*0.15, y+h*0.30, x+w*0.29, y+h*0.35); line(x+w*0.15, y+h*0.40, x+w*0.29, y+h*0.35); //ellipse(x+w*0.23,y+h*7/20,w/6,h/8); fill(255); ellipse(x+w*0.77, y+h*0.35, w/3, h/4); fill(0); ellipse(x+w*0.77, y+h*0.35, w/6, h/8); } //TEXT textSize(w*0.1); if (alpha<=0 || alpha>=255) { dx*=-1; } alpha+=dx; fill(255, alpha); text("KERORO", x+w*0.3, y+h-20); }
วันพุธที่ 2 กันยายน พ.ศ. 2558
Lab03 : Book
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
commit เพิ่มเติม : เพื่ม userstory, bookmark
>> add userstory ทำการเพิ่ม userstory ใน functional tests >> add bookmark for user เพิ่มระบบ Bookmark โดยการสร้าง model ขึ...
-
1 2 3 4 5 6 7 8 9 def setup (): print (d2b( 8 )) def d2b (num): x = "" while num > 0 : x = str ( int (n...
-
1 2 3 4 5 6 7 8 9 10 11 12 13 def test_layout_and_styling ( self ): # Edith goes to the home page self . brow...
-
การใช้ template inheritence คือการสืบทอดเทมเพลต เพื่อให้ไม่ต้องเขียนโค้ดหน้าเว็บๆซ้ำๆ เราจะมีหน้าหลักอันเดียว (base.html or parent) ภายในนั...
ไม่มีความคิดเห็น:
แสดงความคิดเห็น