Created
May 23, 2020 01:59
-
-
Save ryuchan00/776ee1caad9f81afda4fbc6781de9d94 to your computer and use it in GitHub Desktop.
シンガポール🇸🇬みたいな円状に均等に星を配置するやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 🇸🇬 | |
size(120, 120); | |
background(255); | |
noStroke(); | |
fill(152, 251, 152); | |
int a[] = {1,4,2,5,3}; | |
int b; | |
float x; | |
float y; | |
float center_x; | |
float center_y; | |
for (int i = 0; i < 5; i++) { | |
center_x = 50 * cos(2 * PI * i / 5 + PI / 2) + 60; | |
center_y = 50 * sin(2 * PI * i / 5 - PI / 2) + 60; | |
beginShape(); | |
for (int j = 0; j < 5; j++) { | |
b = a[j] - 1; | |
x = 10 * cos(2 * PI * b / 5 + PI / 2) + center_x; | |
y = 10 * sin(2 * PI * b / 5 - PI / 2) + center_y; | |
vertex(x, y); | |
} | |
endShape(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment