文字列をこのプログラムのように環状ではなく円筒状に表示させるようにしたいのですがなかなかうまくできません。分かる方お願いします。
Processing
1void setup(){ 2 size(400,300,P3D); 3 smooth(); 4 textFont(createFont("Tempus Sans ITC",24)); 5} 6 7void draw(){ 8 background(255); 9 pushMatrix(); 10 translate(200, 150, -50); 11 rotateX(map(mouseY, 0, height, PI, -PI)); 12 rotateY(map(mouseX, 0, width, -PI, PI)); 13 14 fill(0, 0, 0, 255); 15 String s="Circle Shape"; 16 float r = 2 * textWidth(s) / PI, theta = PI / s.length(); 17 for(int i = 0; i < s.length(); i++){ 18 pushMatrix(); 19 translate(-r*cos(theta * i),-r*sin(theta * i), 0); 20 rotateZ(theta * i - PI / 2); 21 text(s.charAt(i), 0, 0, 0); 22 popMatrix(); 23 } 24popMatrix(); 25}
あなたの回答
tips
プレビュー