同心円上に並ぶ円
CIRCLE-0700 同心円上に並ぶ円環の半径を次第に大きくしていきます。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
//=========================================== // 同心円上に並ぶ円環の半径を次第に大きくしていく //=========================================== // CreationDate: 2025年3月9日 日曜日16:14:17 //=================【環境設定】================ size(400, 400); //画面サイズ translate(width/2, height/2); //原点を移動 //=================【初期設定】================ noFill(); //塗りつぶしなし ellipseMode(RADIUS); int r=20; //最初の円の中心 int r1=5; //最初の円の半径初期値 int a=4; // 次の円の直径初期値 float dt=radians(10);//回転角度 float x,y; //==================メイン==================== for (int k=1; k<8; k++) { for (float th=0; th<TWO_PI-dt; th+=dt ) { x=r*cos(th); //円の方程式 y=r*sin(th); circle(x, y, r1); //円の描画 } r=r+r1+r1+a/2; //次の円の中心 r1=r1+a/2; //次の円の半径 a+=6; //次の円の拡大量 } |


r=r+r1+r1+a/2; //次の円の中心
r1=r1+a/2; //次の円の半径
a+=6; //次の円の拡大量
参考
X1ターボ/X1シリーズ・プログラム200選 特選グラフィックスデザイン 共著;畠中兼司・北尾和信 発行日:昭和60年5月1日初版発行 発行所:株式会社 学習研究社
CIRCLE-0701 色を付けてみます。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
//=========================================== // 同心円上に並ぶ円環の半径を次第に大きくしていく //=========================================== // CreationDate: 2025年3月14日 金曜日19:8:59 //=================【環境設定】================ size(400, 400); //画面サイズ translate(width/2, height/2); //原点を移動 //=================【初期設定】================ background(0); colorMode(HSB, 360, 100, 100, 100); noStroke(); color c1=color(200, 80, 90, 70); color c2=color(270, 80, 90, 70); color c3=color(200, 80, 90, 70); ellipseMode(RADIUS); //半径モード int r=20; //最初の円の中心 int r1=5; //最初の円の半径初期値 int a=4; // 次の円の直径初期値 float dt=radians(10);//回転角度 float x, y, th=0; //==================メイン==================== for (int k=1; k<8; k++) { for (th=0; th<TWO_PI-dt; th+=dt ) { x=r*cos(th); //円の方程式 y=r*sin(th); if (th<PI) { fill(lerpColor(c1, c2, norm(th, 0, PI))); } else { fill(lerpColor(c2, c3, norm(th, PI, TWO_PI))); } circle(x, y, r1); //円の描画 } r=r+r1+r1+a/2; //次の円の中心 r1=r1+a/2; //次の円の半径 a+=6; //次の円の拡大 } |


コメント