import static util.Common.PI;
import static util.Common.cos360;
import static util.Common.hsb1;
import static util.Common.sin360;
import static util.SVGUtil.*;

public class RandTest {
	// ★　絵文字などの指定（絵文字を使わない時は必要ない）
	private final static String str[] = {
	    "&#128040;", "&#128062;", "&#9829;", "&#9830;", "&#9824;", "&#9827;"
	};
	
    public static void main(String[] args) {
        int i, j;
        int angle;
        int max = 20;             // ★　最大の半径
        start();
        rulers();
        
// ★　塗りつぶす場合（絵文字の場合を含む）、この次の行から
        noStroke();
        fillOpacity(0.3);
// ★　塗りつぶす場合（絵文字の場合を含む）、この前の行までを有効にする。
        
// ★　塗りつぶさない場合、この次の行から
//        noFill();
//        strokeWeight(1);
//        strokeOpacity(0.4);
// ★　塗りつぶさない場合、この前の行までを有効にする。
        
        for(i = 0; 
        		 i < 128;                         // ★　個数
        		        i++) {
            double x, y, h;
// ★　大きさ固定の場合、次の行を有効にする。
//            double r = max;
// ★　大きさランダムの場合、次の行を有効にする。
            double r = randomInRange(1, max);
            x = randomInRange(20 + max / 2, pageWidth() - 20 - max / 2);
            y = randomInRange(30 + max / 2, pageHeight() - 30 - max / 2);
            h = randomInRange(0, 1);
// ★　塗りつぶす場合（絵文字の場合を含む）、次の行を有効にする。
            fill(hsb1(h, 1, 1));
// ★　塗りつぶさない場合、次の行を有効にする。         
//            stroke(hsb1(h, 1, 1));
            
// ★　円の場合、この次の行から          
//            ellipse(x, y, r, r);
// ★　円の場合、この前の行までを有効にする。            

// ★　星形の場合、この次の行から
//            pushMatrix();
//			    translate(x, y);              
//			    beginShape();
//			    for (j = 0, angle = 90; j < 5; j++, angle += 144) {
//				    vertex(r / 2 * cos360(angle), -r / 2 * sin360(angle));
//			    }
//			    endShape(true);
//			    popMatrix();
// ★　星形の場合、この前の行までを有効にする。

// ★　絵文字の場合、この次の行から
            pushMatrix();
			translate(x, y);
            // ★　文字を常にまっすぐ立てるときは次の２行はコメントアウト 「
			angle = (int)randomInRange(0, 359);
            rotate360(angle);
            translate(-r / 2, r / 2);
            textFont("Segoe UI Symbol", r);
			text(str[(int)randomInRange(0, str.length)], 0, 0);
			popMatrix();			
// ★　絵文字の場合、この前の行までを有効にする。
        }

        noStroke();
        
        fill(0x0000ff);
        textFont("Times New Roman", 10);
        text("YYYY MM DD", 225, 40);
        text("Kagawa University", 180, 160);
        text("OpenCampus YYYY", 195, 175);

        finish();
        return;
    }
}
