Skip to content

Instantly share code, notes, and snippets.

@Etclsc
Last active November 7, 2016 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Etclsc/11e4342d86d4f6a74011b2d8c6087d5d to your computer and use it in GitHub Desktop.
Save Etclsc/11e4342d86d4f6a74011b2d8c6087d5d to your computer and use it in GitHub Desktop.
色つき円を表示するサンプルコード
int N = 30; // 円の個数
int dist = 200; // 大円の半径
int hue_step = 360 / N;
int wh = 30;
size(500, 500);
int[] hsbMax = {360, 255, 255};
colorMode(HSB, hsbMax[0], hsbMax[1], hsbMax[2]);
background(360);
noStroke();
translate(width / 2, height / 2);
for(int i = 0; i < N; i++)
{
int x = (int)(dist*cos(2*PI*i/N - PI/2));
int y = (int)(dist*sin(2*PI*i/N - PI/2));
fill(i * hue_step, hsbMax[1], hsbMax[2]);
ellipse(x, y, wh, wh);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment