// Author: Kelvin Sung // Date: October 25, 2012 // Base code for Homework 9a void setup() { size(400, 350); // size of window frameRate(10); // 10 updates per second } void draw() { background(128); // gray background trappedBall(25, 50); } void trappedBall(int x, int y) { // the white box that trap the balls fill(255); rect(x-25, y-50, 50, 50); // box that trap the balls // trapped ball fill(color(255, 0, 0)); // color of the ball ellipse(x+random(-20,20), y-random(5,45), 3, 3); // the ball }