Skip to content

Instantly share code, notes, and snippets.

@ryuchan00
Created May 23, 2020 01:26
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 ryuchan00/64ba9fae307b8be74dae75053527ea86 to your computer and use it in GitHub Desktop.
Save ryuchan00/64ba9fae307b8be74dae75053527ea86 to your computer and use it in GitHub Desktop.
簡単なロジックで星を作る
size(60, 60);
background(255);
noStroke();
fill(152, 251, 152);
int b;
int a[] = {1,4,2,5,3};
beginShape();
for (int i = 0; i < 5; i++) {
b = a[i] - 1;
float x = 30 * cos(2 * PI * b / 5 + PI / 2) + 30;
float y = 30 * sin(2 * PI * b / 5 - PI / 2) + 30;
vertex(x, y);
}
endShape();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment