float x,x1,x2,x3;//光 左 向 き float x4,x5,x6,x7;//光 右 向 き float y10,y11,y12,y13,y14,y15,y16,y17,y18,y19;//泡 float x10,x11,x12,x13,x14,x15,x16,x17,x18,x19;//泡 の X float x20,y20; //fish[] fish = new fish[100]; //fish1[] fish1 = new fish1[15]; int count = 0; int [] x30 = new int [100]; int [] y30 = new int [100]; int [] y31 = new int [100]; String text1 = " click screen"; void setup() { size(500,500); background(100,150,255);//海 の 色 frameRate(7); smooth(); textSize(20); x = 100; x1 = 0; x2 = 200; x3 = 50;//こ こ ま で が 右  x4 = 500; x5 = 500; x6 = 300; x7 = 100;//こ こ ま で が 左 y10 = 600; y11 = 630; y12 = 300; y13 = 1000; y14 = 500; y15 = 200; y16 = 150; y17 = 550; y18 = 700; y19 = 650; noStroke(); for(int i1 =0; i1<15; i1++){ fish1[i1] = new fish1( 70, 20, random(-100,600), random(-50,550), random(3,10),color(random(30,50), random(30,100),255,200)); } noStroke(); for(int i =0; i<100; i++){ fish[i] = new fish( 30, 7, random(-100,600), random(-50,550), random(3,5),color(random(30,70), random(30,150),255,200)); } } void draw() { x += 4; noStroke(); background(0,0,130);//海 の 色 fill(0,255,255,10); if ( x >550) x = 100; triangle( 50, -100, x, 500, x+170, 500); x1 += 1; fill(0,255,255,20); noStroke(); if ( x1 >400) x1 = 0; triangle( 170, -250, x1, 500, x1+250, 500); x2 += 2; fill(0,255,255,10); noStroke(); if ( x2 >550) x1 = 200; triangle( 60, -300, x2, 500, x2+270, 500); x3 += 3; fill(0,255,255,20); noStroke(); if ( x3 >300) x3 =50; triangle( 50, -500, x3-150, 500, x3+350, 500); x4 -= 2; fill(0,255,255,10); if ( x4 <-150) x3 = 500; triangle( 70, -500, x4, 500, x4+250, 500); //kokomadega migi x5 -= 3; fill(0,255,255,20); noStroke(); if ( x5 <20) x5 = 500; triangle( 70, -500, x5-200, 500, x5+450, 500); x6 -= 1; fill(0,255,255,10); noStroke(); if ( x6 <-200) x6 =300; triangle( 70, -500, x6, 500, x6+220, 500); x7 -= 4; fill(0,255,255,10); noStroke(); if ( x7 <-50) x7 =100; triangle( 70, -500, x7-100, 500, x7+300, 500); //kokomadega hikari y14 -= 9; x14 =random(50,80); fill(255,255,255,20); noStroke(); if ( y14 <-50) y14 =2500; ellipse(x14,y14,20,15); ellipse(x14,y14-1,17,12); ellipse(x14-2,y14-3,5,3); y15 -= 6; x15 =random(30,50); fill(255,255,255,20); noStroke(); if ( y15 <-50) y15 =550; ellipse(x15,y15,20,15); ellipse(x15,y15-1,17,12); ellipse(x15-2,y15-3,5,3); y16 -= 7; x16 =random(470,500); fill(255,255,255,20); noStroke(); if ( y16 <-50) y16 =700; ellipse(x16,y16,20,15); ellipse(x16,y16-1,17,12); ellipse(x16-2,y16-3,5,3); y17 -= 8; x17 =random(230,250); fill(255,255,255,20); noStroke(); if ( y17 <-50) y17 =1000; ellipse(x17,y17,20,15); ellipse(x17,y17-1,17,12); ellipse(x17-2,y17-3,5,3); y18 -= 9; x18 =random(210,240); fill(255,255,255,20); noStroke(); if ( y18 <-50) y18 =800; ellipse(x18,y18,20,15); ellipse(x18,y18-1,17,12); ellipse(x18-2,y18-3,5,3); y19 -= 8; x19 =random(110,150); fill(255,255,255,20); noStroke(); if ( y19 <-50) y19 =1000; ellipse(x19,y19,20,15); ellipse(x19,y19-1,17,12); ellipse(x19-2,y19-3,5,3); //kokomadegaawa for(int i1 =0; i1<15; i1++){ fish1[i1].update(); } for(int i =0; i<100; i++){ fish[i].update(); } y10 -= 7; x10 =random(350,380); fill(255,255,255,20); noStroke(); if ( y10 <-50) y10 =1000; ellipse(x10,y10,40,30); ellipse(x10,y10-2,35,25); ellipse(x10-6,y10-7,10,5); y11 -= 7; x11 =random(330,350); fill(255,255,255,20); noStroke(); if ( y11 <-50) y11 =1000; ellipse(x11,y11,20,15); ellipse(x11,y11-1,17,12); ellipse(x11-2,y11-3,5,3); y12 -= 7; x12 =random(150,180); fill(255,255,255,20); noStroke(); if ( y12 <-50) y12 =550; ellipse(x12,y12,40,30); ellipse(x12,y12-2,35,25); ellipse(x12-6,y12-7,10,5); y13 -= 8; x13 =random(220,250); fill(255,255,255,20); noStroke(); if ( y13 <-50) y13 =1400; ellipse(x10,y10,35,25); ellipse(x10,y10-2,30,20); ellipse(x10-6,y10-7,10,5); for(int i = 0; i< count; i++){ y30[i] -= 3; if( y31[i] < y30[i]+20){ y31[i] +=5; } if( y31[i] > y30[i]){ y31[i] -=5; } noStroke(); fill( 180, 180, 255); ellipse( x30[i], y30[i], 25, 20); ellipse( x30[i], y30[i]+25, 20, 40); triangle( x30[i]-10, y30[i]-5, x30[i]-5, y30[i]-17, x30[i]-2, y30[i]-9); triangle( x30[i]+10, y30[i]-5, x30[i]+5, y30[i]-17, x30[i]+2, y30[i]-9); quad( x30[i]-10, y30[i]+10, x30[i]-30, y31[i], x30[i]-20, y30[i]+25, x30[i]-5, y30[i]+25); quad( x30[i]+10, y30[i]+10, x30[i]+30, y31[i], x30[i]+20, y30[i]+25, x30[i]+5, y30[i]+25); fill( 255, 0, 0, 70); ellipse( x30[i], y30[i], 15, 13); ellipse( x30[i], y30[i]+20, 13, 27); } fill(255); text(text1, 350, 450); } class fish{ float radiw, radih, posx, posy, speed; color clr; fish(float w, float h, float x20, float y20, float s,int c){ radiw = w; radih = h; posx = x20; posy = y20; speed = s; clr = c; } void update(){ posx -= speed; if(posx + radiw < -200){ posx =600; } fill(clr); ellipse( posx, posy, radiw, radih); ellipse( posx, posy, radiw, radih); quad( posx+5, posy, posx+23, posy-5, posx+20, posy, posx+23, posy+5); quad(posx-13, posy+3, posx-3, posy-7, posx+7, posy-6, posx+10, posy-3); quad(posx-10, posy+3, posx-7, posy+4, posx, posy+5, posx+3, posy+3); quad(posx-5, posy+3, posx+6, posy+5, posx+7, posy+5, posx+10, posy+3); } } class fish1{ float radiw1, radih1, posx1, posy1, speed1; color clr1; fish1(float w1, float h1, float x21, float y21, float s1,int c1){ radiw1 = w1; radih1 = h1; posx1 = x21; posy1 = y21; speed1 = s1; clr1 = c1; } void update(){ posx1 -= speed1; if(posx1 + radiw1 < -200){ posx1 =600; } fill(clr1); ellipse(posx1, posy1, radiw1, radih1); ellipse(posx1, posy1, radiw1, radih1); quad(posx1+20, posy1, posx1+55, posy1-10,posx1+40, posy1, posx1+45, posy1+10); quad(posx1-25, posy1-3, posx1-5, posy1-13, posx1+25, posy1-17, posx1+10, posy1-8); quad(posx1-20, posy1+3, posx1-10, posy1+15, posx1, posy1+10, posx1+13, posy1+3); quad(posx1-15, posy1+3, posx1+30, posy1+15, posx1+20, posy1+10, posx1+25, posy1+3); } } void mousePressed(){ if(mouseButton == LEFT){ if(count<100){ x30[count] = mouseX; y30[count] = mouseY; y31[count] = mouseY + 5; count++; } } } // 参考 // デザイン言語 Processing 入門楽しく学ぶコンピテーショナルデザイン  三井 和男著 森北出版株式会社   // http://wiki.bmoon.jp/wiki.cgi/Programming?page=%A4%BF%A4%AF%A4%B5%A4%F3%A4%CE%BF%DE%B7%C1%A4%F2%C6%B0%A4%AB%A4%B9