//提出課題-U〜惑星ロック・オン☆〜 void setup() { //ウィンドウサイズ:500×500 size(500, 500); //カーソル:待機時用 cursor(WAIT); } float x = 0.0; float y = 0.0; int deg = 0; int s = 0; void draw() { //背景:黒 background(0); //球 サイズ・色・動き:大・紫→灰・なし stroke(0); fill(100, s, 150); ellipse(150, 150, 100, 100); deg = deg + 1; s = s + 1; if(100 < s) s = 0; //球 サイズ・色・動き:小・橙・楕円 x = height / 2 + 100.0 * cos(radians(deg)); y = width / 2 + 200.0 * sin(radians(deg)); stroke(0); fill(300, 76, 100); ellipse(int(x), int(y), 20, 20); //球 サイズ・色・動き:小・朱・楕円 x = height / 2 + 200.0 * sin(radians(deg)); y = width / 2 + 100.0 * cos(radians(deg)); fill(252, 144, 47); ellipse(int(x), int(y), 20, 20); deg = deg + 1; y = y + 1; //マウス:クリック→変化 if(mousePressed == true) { x = mouseX; y = mouseY; //マウスの左ボタンをクリック:赤・太め if(mouseButton == LEFT) { stroke(255, 0, 0); strokeWeight(5); } //マウスの右ボタンをクリック:青・太め else if(mouseButton == RIGHT) { stroke(0, 0, 255); strokeWeight(5); } //それ以外をクリック:緑・太め else { stroke(0, 255, 0); strokeWeight(5); } line(x-10, y-10, x+10, y+10); line(x-10,y+10, x+10, y-10); } //お星さま(左上・右上・右下):白 stroke(255); line(300, 100, 320, 100); line(310, 90, 310, 110); line(320, 120, 330, 120); line(325, 115, 325, 125); line(400, 400, 450, 400); line(425, 375, 425, 430); }