The Design and Implementation of Multimedia Software
An Example with Aggregate Static Visual Content(Buzzy)

The Code for Buzzy

BoringBuzzy.prototype = new AggregateDescribedContent();
BoringBuzzy.prototype.constructor = BoringBuzzy;

function BoringBuzzy()
{
   var helmetShape, visorShape;       
   var stroke;
   var black, gold, gray, purple;
   var body, hair, helmet, visor;
   var bodyShape;       
   var hairShape;

   var black  = "black";
   var gold   = "rgb(194,161, 77)";
   var gray   = "rgb(170,170,170)";
   var purple = "rgb( 69,  0,132)";

   stroke = null;   

   bodyShape = new Path2D();
   bodyShape.moveTo( 20, 50);
   bodyShape.lineTo( 20, 70);
   bodyShape.lineTo( 20, 90);
   bodyShape.lineTo( 10, 90);
   bodyShape.lineTo( 10,100);
   bodyShape.lineTo( 80,100);
   bodyShape.lineTo( 80, 90);
   bodyShape.lineTo( 40, 90);
   bodyShape.lineTo( 40, 70);
   bodyShape.lineTo( 40, 50);
   bodyShape.closePath();

   body = new DescribedContent(bodyShape, black, purple, stroke);
   this.add(body);

   hairShape = new QuadCurve2D(10,2,40,10,30,25);       
   hair = new DescribedContent(hairShape, purple, null, stroke);
   this.add(hair);

   helmetShape = new Ellipse2D(2,20,70,40);
   helmet=new DescribedContent(helmetShape, black, gold, stroke);
   this.add(helmet);

   visorShape = new Arc2D(40,25,35,30,-45,90,Arc2D.PIE);
   visor=new DescribedContent(visorShape, black, gray, stroke);
   this.add(visor);
}