そして行いたいことは、
「通過点(mx,my)の座標を保存し、そこを軸に動くアニメーションです」
です。
そこで、
Processing
1 v = (new PVector(end_x-start_x,end_y-start_y)).normalize(); 2rad =v.heading(); 3 4if((video.duration()/5) < time && time < (video.duration()*3/5)){ 5if(i==1){ 6 mx=ex; 7 my=ey; 8 i++; 9} 10 pushMatrix(); 11 translate(mx,my); 12 rotate(rad); 13 rect(-t,0,30,30); 14 rect(-t,-t,30,30); 15 rect(-t,-t,30,30); 16 t=t+30 17 popMatrix(); 18} 19 20if((video.duration()*2/5) < time && time < (video.duration()*4/5)){ 21if(i2==1){ 22 mx2=ex; 23 my2=ey; 24 i2++; 25} 26 pushMatrix(); 27 translate(mx2,my2); 28 rotate(rad); 29 rect(-t,0,30,30); 30 rect(-t,-t,30,30); 31 rect(-t,-t,30,30); 32 t=t+30 33 popMatrix(); 34}
draw関数の一部です。
これで図形がうまく思うところに描画されないのは、ifの時間の範囲が被っているために、
translateで原点が(mx,my)の時に次の(mx2,my2)に(ex,ey)が代入されるなどして、座標の位置関係がよくわからないことになってしまっているのでしょうか。
回答1件
あなたの回答
tips
プレビュー