枠と内部の色を同じにする
円をたくさん描くときに色をランダムにして、
かつ円の枠の色と内部の色は同じにするにはどうしたら良いですか。
[添付]: 5402 bytes
sou 2015/07/25(Sat) 22:59 No.2158
Re: 枠と内部の色を同じにする
rnd関数は使うごとに異なる値を返します。
これでは異なる色になります。
SetLineColor(P, hsl(0.3, 1, 1/4+rnd(2)/2))
SetInsideColor(P, hsl(0.3, 1, 1/4+rnd(2)/2))
改良案1
x := rnd(2)
SetLineColor(P, hsl(0.3, 1, 1/4 + x/2))
SetInsideColor(P, hsl(0.3, 1, 1/4 + x/2))
改良案2
x := hsl(0.3,1,1/4 + rnd(2)/2)
SetLineColor(P, x)
SetInsideColor(P, x)
これでは異なる色になります。
SetLineColor(P, hsl(0.3, 1, 1/4+rnd(2)/2))
SetInsideColor(P, hsl(0.3, 1, 1/4+rnd(2)/2))
改良案1
x := rnd(2)
SetLineColor(P, hsl(0.3, 1, 1/4 + x/2))
SetInsideColor(P, hsl(0.3, 1, 1/4 + x/2))
改良案2
x := hsl(0.3,1,1/4 + rnd(2)/2)
SetLineColor(P, x)
SetInsideColor(P, x)
ともだ 2015/07/26(Sun) 00:32 No.2159
Re: 枠と内部の色を同じにする
解決しました。ありがとうございます。
sou 2015/07/26(Sun) 12:00 No.2160