processing--简单文字图像动画
图像动画1:
1 int timer, startTime=0, currentTime; 2 float scl_a, scl_b=1, scl_c; 3 float angle; 4 float tt1, tt2; 5 PFont myfont; 6 void setup() { 7 size(1280, 720); 8 rectMode(CENTER); 9 noStroke(); 10 myfont= createFont("simhei.ttf", 32); 11 } 12 void draw() { 13 background(220); //设置浅灰色背景 14 currentTime=millis(); 15 timer = currentTime-startTime; 16 //绘制蓝色矩形 17 scl_a = timer/15; 18 if (scl_a>=200) { 19 scl_a =200; 20 } 21 fill(87, 145, 255); 22 push(); 23 translate(width/2, height/2); 24 scale(scl_a/200); 25 rect(0, 0, width, height); 26 pop(); 27 //绘制浅绿色矩形 28 scl_b = (timer-3000)/50; 29 if (scl_b<=0) { 30 scl_b=0; 31 } 32 if (scl_b>=100) { 33 scl_b=100; 34 } 35 angle =(timer-3000)*PI/36000; 36 if (angle>=PI/6) { 37 angle=PI/6; 38 } 39 fill(0, 210, 176); 40 push(); 41 translate(width/2, height/2); 42 rotate(-angle); 43 scale(scl_b/200, 2.0); 44 rect(0, 0, width, height); 45 pop(); 46 //绘制粉色图形1 47 fill(238, 35, 110); 48 push(); 49 translate(width/2, height/2); 50 rotate(-PI/6); 51 rect(-720, -80, 300, 500); 52 pop(); 53 //绘制粉色图形2 54 fill(238, 35, 110); 55 push(); 56 translate(width/2, height/2); 57 rotate(-PI/6); 58 rect(728, 80, 300, 500); 59 pop(); 60 //大文字 61 tt1=(timer-5000)/50; 62 if (tt1<=0) { 63 tt1=0; 64 } 65 blendMode(SCREEN); 66 textSize(419); 67 fill(150, tt1); 68 text("D-FORM STUDIO", width/2, height/2, width, height*1.5); 69 fill(50); 70 text("D-FORM STUDIO", width/2+5, height/2+5, width, height*1.5); 71 blendMode(BLEND); 72 //绘制橙色矩形 73 scl_c =(timer-3000)/60; 74 if (scl_c <=0) { 75 scl_c=0; 76 } 77 if (scl_c >=120) { 78 scl_c=120; 79 } 80 fill(255, 198, 15); 81 push(); 82 translate(width/2, height/2); 83 scale(scl_c/200, 0.7); 84 rect(0, 0, width, height); 85 pop(); 86 //标题文字 87 tt2=(timer-7000)/20; 88 if (tt2<0) { 89 tt2=0; 90 } 91 textFont(myfont); 92 textSize(140); 93 textAlign(CENTER); 94 fill(50, tt2/8); 95 text("人生", width/2+5, height/2+5); 96 text("如天候", width/2+5, height/2+140+5); 97 fill(250, tt2); 98 text("人生", width/2, height/2); 99 text("如天候", width/2, height/2+140); 100 } 101 void mouseClicked() { 102 startTime = currentTime; 103 redraw(); 104 }


浙公网安备 33010602011771号