class Radio { float x, y, w, speed, a; Radio (float x_, float y_, float w_, float speed_, float a_) { x = x_; y = y_; w = w_; speed = speed_; a = a_; } void displayr () { noStroke (); fill (255,158,0, a); ellipse (x,y,w,w); } void mover () { if (random(1.0) < 0.5) { x += speed; y -= speed*0.5; } if (random(1.0) > 0.5) { x+= speed*2; y-= speed*0.8; } x = x + random( - 3,3)* speed; y = y + random( - 3,3)* speed; x = constrain (x,0,width); y = constrain (y,0,height); a = a + 2 * speed; if (a > 100) { a-=40; } else if (a < 20) { a+=40; } } void bouncer () { if ( y < 1 || y> (height-1) || x < 1 || x > (width-1)) { speed = speed * -0.95; } if (buttonr) { if (random(1.0) < 0.02) { Radio rs = new Radio (random(250,270), random(390,400), random(7,12), random(4), random (85,20)); radios = (Radio []) append (radios, rs); } } } }