

randを使って位置、大きさ、カラーをランダムな値にして円を描きます。
今回はRGBではなくHSBカラーで設定しています。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | %!PS-Adobe-3.0 EPSF-3.0 %%BoundingBox: 0 0 240 240 %%Title:ランダムにサークルパターンを描く /x rand 201 mod 100 sub def % x座標(-100〜100) /y rand 201 mod 100 sub def % y座標(-100〜100) /rad { rand 40 mod 1 add } def % 半径(1〜40) /randam_color { % ランダムカラー /h rand 11 mod 0.1 mul def % H色相(0~1) /s rand 7 mod 0.1 mul def % S彩度(0~0.6) /b rand 4 mod 5 add 0.1 mul def % B明度(0.5~0.8) h s b sethsbcolor % HSBカラーを設定する } def newpath % パスの初期化 0 1 50 { % 0から1づつ増やし50になるまで{ }内を繰り返す randam_color% ランダムカラープロシージャ呼び出し x y rad 0 360 arc fill %塗りつぶし円を描く } for |
コメント