tutorialscenes.C



#include <stream.h>
#include <strings.h>
#include "../polka.H"
#include "tutorial.H"

MyAnimator anim;



Line *global_line;
Action *global_action;

void
timerCB(View *, int frame, void *)
{
   printf("We're in the timer callback, frame = %d\n\n",frame);
}


void
animObjectCB(AnimObject *, void *data, double x, double y)
{
   printf("We're in the AnimObject pick callback\n");
   printf("data=%d  at coord (%lf, %lf)\n\n",data,x,y);
}




int
MyAnimator::Controller()
{
   if (!strcmp(AlgoEvtName,"op1"))
      s.scene1();
   else if (!strcmp(AlgoEvtName,"op2"))
      s.scene2();
   else if (!strcmp(AlgoEvtName,"op3"))
      s.scene3();
   else if (!strcmp(AlgoEvtName,"op4"))
      s.scene4();
   else if (!strcmp(AlgoEvtName,"op5"))
      s.scene5();
   else if (!strcmp(AlgoEvtName,"op6"))
      s.scene6();
   else if (!strcmp(AlgoEvtName,"op7"))
      s.scene7();
   else if (!strcmp(AlgoEvtName,"op8"))
      s.scene8();
   else if (!strcmp(AlgoEvtName,"op9"))
      s.scene9();
   else if (!strcmp(AlgoEvtName,"op10"))
      s.scene10();
   else if (!strcmp(AlgoEvtName,"op11"))
      s.scene11();
   else
      s.CheckInput();
   return (1);
}

int
Stuff::scene1()
{
   static double poly1_x[4] = { -0.099388 ,0.022936 ,0.117737 ,0.181957 };
   static double poly1_y[4] = { 0.145260 ,0.237003 ,0.177370 ,0.284404 };
   static double p2x[4] = { 0.1, 0.1, 0.1, 0.1 };
   static double p2y[4] = { 0.1, 0.1, 0.1, 0.1 };
   static double p3x[4] = { 0.0, 0.0, 0.0, -0.2 };
   static double p3y[4] = { 0.0, 0.0, 0.0, 0.1 };
   static double path1_x[133] = { 0.000000,-0.003058,0.000000,-0.001529,-0.001529,-0.001529,-0.003058,-0.003058,-0.003058,-0.012232,-0.009174,-0.003058,-0.012232,-0.009174,-0.006116,-0.009174,-0.003058,-0.004587,-0.001529,0.000000,0.000000,0.001529,0.003058,0.001529,0.004587,0.006116
     ,0.009174,0.006116,0.004587,0.001529,0.004587,0.004587,0.006116,0.003058,0.001529,0.000000,-0.001529,-0.001529,-0.001529,0.000000,-0.001529,0.000000,0.001529,0.003058,0.006116,0.012232,0.012232,0.015291,0.012232,0.012232,0.012232
     ,0.012232,0.009174,0.009174,0.009174,0.009174,0.006116,0.003058,0.003058,0.000000,0.000000,-0.003058,-0.003058,-0.001529,0.000000,0.000000,0.003058,0.001529,0.004587,0.004587,0.006116,0.015291,0.009174,0.003058,0.001529,0.003058
     ,0.003058,0.000000,0.000000,-0.003058,-0.003058,-0.006116,-0.009174,-0.012232,-0.012232,-0.012232,-0.012232,-0.009174,-0.015291,-0.009174,-0.006116,-0.001529,0.000000,0.000000,0.000000,0.001529,0.001529,0.001529,-0.001529,0.000000,-0.001529
     ,-0.003058,-0.004587,-0.003058,-0.004587,-0.004587,-0.004587,-0.003058,-0.003058,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,-0.001529,-0.001529,-0.001529,-0.006116,-0.006116,-0.001529,0.000000,0.000000,0.001529,0.001529,0.001529
     ,0.001529,0.000000,0.000000,0.000000,0.000000,0.001529,0.000000 };
   static double path1_y[133] = { -0.001529,-0.007645,-0.003058,-0.003058,-0.003058,-0.003058,-0.004587,-0.003058,-0.003058,-0.006116,-0.003058,-0.001529,-0.001529,-0.001529,0.001529,0.001529,0.004587,0.003058,0.004587,0.004587,0.006116,0.006116,0.004587,0.004587,0.004587,0.006116
     ,0.009174,0.006116,0.004587,0.004587,0.006116,0.012232,0.012232,0.012232,0.015291,0.009174,0.004587,0.004587,0.004587,0.001529,0.004587,0.003058,0.006116,0.015291,0.009174,0.012232,0.006116,0.004587,0.003058,0.001529,0.000000
     ,-0.001529,-0.003058,-0.003058,-0.004587,-0.009174,-0.012232,-0.009174,-0.009174,-0.006116,-0.009174,-0.012232,-0.015291,-0.012232,-0.015291,-0.012232,-0.006116,-0.006116,-0.004587,-0.001529,-0.001529,-0.003058,-0.004587,-0.003058,-0.004587,-0.004587
     ,-0.009174,-0.012232,-0.012232,-0.009174,-0.012232,-0.009174,-0.009174,-0.006116,-0.004587,-0.004587,-0.001529,0.000000,0.001529,0.006116,0.009174,0.009174,0.004587,0.004587,0.009174,0.009174,0.009174,0.009174,0.015291,0.012232,0.009174
     ,0.006116,0.004587,0.003058,-0.001529,-0.003058,-0.004587,-0.009174,-0.015291,-0.012232,-0.009174,-0.004587,-0.006116,-0.001529,-0.003058,-0.004587,-0.001529,-0.001529,0.000000,0.003058,0.003058,0.006116,0.006116,0.009174,0.004587,0.006116
     ,0.004587,0.001529,0.003058,0.001529,0.001529,0.001529,0.000000 };
   int len;

   static double ldx[4] = {0.08, -0.08, -0.08, 0.08};
   static double ldy[4] = {-0.08, -0.08, 0.08, 0.08};

   cout << "Welcome to the Polka tutorial" << endl;
   cout << "It shows off some of the package's features\n" << endl;

   Create("Goofy animations",CoordStretch,700,500);
   cout << "Notice the non-standard size View" << endl;
   cout << "To see a good example of multiple Views, check out" << endl;
   cout << "knight or Parallel/psortn.\n" << endl;

   RegisterTimerCallback(100, timerCB, NULL);
   cout << "Now we register a timer callback to go off at frame 100\n" <<
            endl;

   global_line = new Line(this, 1, 0.9, 0.9, 0.0, 0.08, 
                    "black", 0.5, 1.000000, 0);
   global_line->Originate(time);
   global_action = new Action("RESIZE", 4, ldx, ldy);
   global_line->ProgramContinuous(time, global_action);
   cout << "The line in the upper right has been programmed with a" << endl;
   cout << "continuous Action.  It keeps going til we tell it to stop.\n"
        << endl;

   cout << "Now we GRAB and RESIZE some lines\n" << endl;

   Polyline *poly1 = new Polyline(this, 1, 0.475535, 0.282875, 
		    5, poly1_x, poly1_y, "black", 0.000000, 1.000000, 3);
   Polyline *poly2 = new Polyline(this, 1, 0.2, 0.2,
		      5, p2x, p2y, "black", 0.000000, 1.000000, 1);
   Polyline *poly3 = new Polyline(this, 1, 0.7, 0.7,
		      5, p3x, p3y, "black", 0.000000, 1.000000, 2);
   poly1->Originate(time);
   poly2->Originate(time);
   poly3->Originate(time);
   Action path1("GRAB1", 133, path1_x, path1_y);
   Action *path2 = path1.Rotate(37);
   Action *path2a = path2->ChangeType("GRAB2");
   Action *path3 = path1.Rotate(125);
   Action *path3a = path3->ChangeType("GRAB3");
   Action *path4 = path1.Rotate(244);
   Action *path4a = path4->ChangeType("GRAB4");
   len = poly1->Program(time, &path1);
   len = poly1->Program(time, path2a);
   len = poly1->Program(time, path3a);
   len = poly1->Program(time, path4a);
   time = Animate(time,len);
   delete(path2);
   delete(path2a);
   delete(path3);
   delete(path3a);
   delete(path4);
   delete(path4a);

   Action a("RESIZE2",STRAIGHT);
   len = poly2->Program(time, &a);
   time = Animate(time,len);

   Action *a2 = a.Rotate(90);
   len = poly3->Program(time, a2);
   time = Animate(time, len);
   delete (a2);
   return(1);
}





int
Stuff::scene2()
{
   static double spl_x[3] = { 0.3 ,0.36 ,0.12 };
   static double spl_y[3] = { 0.1 ,0.4 ,0.31 };
   static double p1_x[87] = { 0.001344,0.009409,-0.001344,0.002688,-0.001344,0.000000,0.000000,0.005376,0.000000,0.000000,0.002688,0.002688,0.008065,0.004032,0.000000,0.000000,0.000000,0.013441,0.000000,0.016129,0.001344,0.005376,0.000000,0.002688,0.002688,0.001344
     ,0.000000,0.000000,-0.002688,-0.005376,-0.004032,-0.005376,-0.005376,-0.005376,-0.005376,-0.005376,0.000000,0.000000,-0.001344,0.001344,0.000000,0.005376,0.005376,0.013441,0.016129,0.001344,0.005376,0.000000,-0.001344,0.001344,0.000000
     ,0.004032,0.005376,0.005376,0.000000,0.001344,0.002688,0.001344,0.000000,0.001344,-0.001344,0.000000,0.000000,-0.001344,-0.008065,-0.008065,-0.008065,-0.005376,-0.013441,-0.026882,-0.008065,-0.002688,-0.002688,0.001344,-0.001344,0.000000
     ,0.001344,-0.001344,0.000000,0.000000,-0.001344,0.001344,-0.005376,-0.005376,0.000000,-0.005376,0.000000 };
   static double p1_y[87] = { -0.013441,-0.064516,-0.008065,-0.008065,-0.008065,-0.005376,-0.008065,-0.008065,-0.008065,-0.004032,-0.002688,-0.002688,-0.001344,0.000000,0.001344,0.001344,0.002688,0.004032,0.005376,0.008065,0.005376,0.005376,0.008065,0.008065,0.010753,0.013441
     ,0.010753,0.005376,0.005376,0.004032,0.004032,0.002688,0.002688,0.000000,0.001344,0.002688,0.002688,0.005376,0.005376,0.010753,0.010753,0.010753,0.005376,0.004032,0.001344,-0.001344,-0.004032,-0.004032,-0.008065,-0.013441,-0.008065
     ,-0.008065,-0.004032,-0.004032,0.001344,0.004032,0.005376,0.010753,0.013441,0.016129,0.010753,0.010753,0.013441,0.013441,0.008065,0.008065,0.002688,0.000000,0.001344,-0.002688,-0.002688,-0.004032,-0.002688,-0.002688,-0.002688,-0.002688
     ,0.000000,-0.002688,-0.002688,-0.005376,-0.005376,-0.005376,-0.008065,-0.008065,-0.002688,-0.001344,0.000000 };
   static double p2_x[91] = { 0.009409,0.008065,0.008065,0.001344,0.002688,0.002688,0.000000,0.000000,0.005376,0.005376,0.001344,0.013441,0.001344,0.002688,0.002688,0.004032,0.001344,-0.001344,-0.004032,-0.001344,-0.001344,0.001344,-0.010753,-0.016129,-0.016129,-0.010753
     ,-0.004032,-0.004032,0.000000,-0.002688,-0.018817,-0.008065,-0.016129,-0.002688,-0.010753,-0.008065,0.001344,0.000000,-0.001344,0.001344,0.001344,0.004032,0.005376,0.005376,0.008065,0.013441,0.005376,0.005376,0.005376,0.016129,0.005376
     ,0.005376,0.005376,0.016129,0.013441,0.002688,0.010753,0.016129,0.001344,0.008065,-0.002688,0.005376,0.001344,0.005376,0.000000,0.018817,0.013441,0.016129,0.000000,0.010753,0.004032,0.000000,-0.002688,-0.002688,-0.001344,-0.005376
     ,-0.013441,-0.024194,-0.026882,-0.013441,-0.004032,-0.001344,-0.001344,-0.005376,-0.005376,-0.010753,0.000000,-0.008065,-0.002688,-0.001344,0.000000 };
   static double p2_y[91] = { -0.072581,-0.010753,-0.010753,-0.004032,-0.002688,-0.001344,-0.001344,-0.001344,0.000000,0.000000,0.002688,0.004032,0.004032,0.005376,0.010753,0.010753,0.008065,0.008065,0.010753,0.010753,0.004032,0.001344,-0.001344,-0.001344,-0.005376,-0.010753
     ,-0.010753,-0.001344,-0.001344,-0.004032,-0.004032,-0.005376,-0.004032,-0.001344,0.004032,0.008065,0.013441,0.010753,0.005376,0.010753,0.018817,0.016129,0.016129,0.013441,0.010753,0.013441,0.013441,0.010753,0.002688,-0.001344,-0.002688
     ,-0.004032,-0.010753,-0.016129,-0.013441,-0.016129,-0.013441,-0.016129,-0.016129,-0.013441,-0.013441,-0.008065,-0.010753,-0.004032,-0.001344,0.000000,0.005376,0.016129,0.024194,0.024194,0.026882,0.021505,0.024194,0.018817,0.016129,0.004032
     ,0.001344,-0.001344,-0.002688,-0.008065,-0.008065,-0.008065,-0.010753,-0.005376,-0.005376,-0.010753,-0.010753,-0.018817,-0.005376,-0.001344,0.000000 };
   static double p3_x[82] = { -0.017473,-0.006720,0.000000,0.000000,0.000000,0.000000,0.000000,-0.001344,0.008065,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.005376,0.021505,0.010753,-0.001344,0.001344,0.005376,0.000000,0.005376,0.000000,-0.005376
     ,0.000000,-0.013441,-0.008065,-0.016129,-0.010753,-0.010753,-0.002688,-0.010753,0.000000,0.000000,0.001344,0.000000,0.000000,0.004032,0.016129,0.000000,0.004032,0.008065,0.001344,0.004032,0.000000,0.000000,-0.008065,-0.040323,-0.037634
     ,-0.032258,-0.026882,-0.010753,0.000000,0.000000,-0.001344,0.004032,0.008065,0.005376,-0.001344,0.013441,0.021505,0.001344,0.004032,0.016129,0.005376,0.008065,0.004032,0.001344,0.004032,0.005376,0.005376,0.016129,0.016129,0.000000
     ,0.002688,0.004032,0.002688,0.001344,0.001344,0.000000 };
   static double p3_y[82] = { 0.014785,0.021505,0.005376,0.004032,0.005376,0.004032,0.004032,0.013441,0.010753,0.010753,0.004032,-0.002688,-0.001344,-0.013441,-0.005376,-0.004032,-0.010753,-0.018817,-0.016129,-0.021505,-0.021505,-0.026882,-0.032258,-0.026882,-0.021505,-0.013441
     ,-0.002688,-0.002688,-0.001344,0.002688,0.008065,0.008065,0.010753,0.010753,0.010753,0.008065,0.005376,0.002688,0.005376,0.021505,0.008065,0.004032,-0.002688,-0.005376,-0.001344,0.002688,0.004032,0.005376,0.004032,-0.001344,-0.004032
     ,-0.002688,0.000000,0.000000,0.002688,0.005376,0.010753,0.016129,0.016129,0.005376,0.001344,0.000000,0.001344,-0.002688,-0.008065,-0.008065,-0.008065,-0.005376,-0.005376,-0.001344,0.000000,0.001344,0.005376,0.005376,0.010753,0.002688
     ,-0.002688,-0.004032,-0.004032,-0.001344,-0.001344,0.000000 };
   int len;

   cout << "Polka can do splines. Wow.\n" << endl;
   Spline *spl = new Spline(this, 1, 0.383065, 0.346774, 
                4, spl_x, spl_y, "maroon", 0.5, 1.000000);
   spl->Originate(time);
   Action a1("GRAB1", 87, p1_x, p1_y);
   Action a2("GRAB2", 91, p2_x, p2_y);
   Action a3("GRAB3", 82, p3_x, p3_y);
   spl->Program(time, &a1);
   len = spl->Program(time, &a2);
   spl->Program(time, &a3);
   time = Animate(time,len);

   return(1);
}





int
Stuff::scene3()
{
   static double polygon1_x[5] = { 0.128882 ,0.150621 ,0.091615 ,-0.069876 ,-0.091615 };
   static double polygon1_y[5] = { 0.020186 ,0.156832 ,0.206522 ,0.156832 ,0.074534 };
   static double path_x[72] = { 0.013975,-0.001553,0.003106,0.004658,0.001553,0.004658,0.001553,0.001553,0.001553,0.000000,0.000000,0.000000,0.000000,0.001553,0.006211,0.003106,0.012422,0.012422,0.004658,0.000000,0.003106,0.000000,-0.003106,-0.001553,-0.015528,-0.012422
     ,-0.015528,-0.006211,0.000000,-0.003106,-0.003106,-0.003106,-0.001553,-0.004658,-0.009317,-0.004658,-0.003106,-0.001553,-0.003106,-0.004658,-0.006211,-0.012422,-0.015528,-0.006211,-0.001553,-0.006211,0.000000,0.000000,0.000000,0.000000,0.006211
     ,0.003106,0.003106,0.001553,0.004658,0.000000,0.004658,0.001553,0.004658,0.001553,-0.001553,0.000000,0.003106,0.001553,0.001553,0.006211,0.009317,0.009317,0.006211,0.003106,0.003106,0.000000 };
   static double path_y[72] = { 0.020186,0.001553,0.000000,0.000000,0.004658,0.004658,0.003106,0.006211,0.003106,0.006211,0.006211,0.003106,0.003106,0.006211,0.004658,0.001553,-0.001553,0.000000,0.003106,0.001553,0.012422,0.012422,0.003106,0.001553,-0.001553,0.000000
     ,-0.001553,-0.003106,-0.001553,-0.003106,-0.004658,-0.003106,-0.003106,-0.003106,0.000000,0.003106,0.003106,0.003106,0.003106,0.006211,0.003106,0.001553,-0.001553,-0.001553,-0.003106,-0.009317,-0.004658,-0.003106,-0.004658,-0.004658,-0.006211
     ,-0.004658,0.000000,-0.001553,-0.001553,-0.004658,-0.003106,-0.003106,-0.003106,-0.006211,-0.006211,-0.004658,-0.003106,-0.004658,-0.003106,0.000000,0.003106,0.000000,-0.003106,-0.003106,-0.003106,0.000000 };
   int len;

   cout << "This illustrates the difference between a GRAB Action" << endl;
   cout << "   (only moves one vertex)" << endl;
   cout << "and a RESIZE Action" << endl;
   cout << "   (moves all vertices after a particular one).\n" << endl;

   Polygon *polygon1 = new Polygon(this, 1, 0.672360, 0.288820, 
                 6, polygon1_x, polygon1_y, "green", 1.000000);
   polygon1->Originate(time);
   Action a("GRAB3", 72, path_x, path_y);
   len = polygon1->Program(time, &a);

   Polygon *polygon2 = new Polygon(this, 1, 0.3, 0.288820, 
              6, polygon1_x, polygon1_y, "green", 1.000000);
   polygon2->Originate(time);
   Action b("RESIZE3", 72, path_x, path_y);
   len = polygon2->Program(time, &b);
   time = Animate(time, len);
   return(1);
}






int
Stuff::scene4()
{
   double  px[7],py[7];
   Action *path,*patht,*pathr;
   int len;

   cout << "Here's an ellipse whose color is #F347B6" << endl;
   cout << "  That's #RRGGBB speak.\n" << endl;

   Ellipse *ellipse = new Ellipse(this,1,0.2,0.6,0.1,0.05,"#F347B6",1.0);
   ellipse->Originate(time);
   path =  new Action("MOVE",CLOCKWISE);
   len = ellipse->Program(time,path);
   time = Animate(time,len);

   px[0] = 0.05;    py[0] = 0.1;
   px[1] = -0.05;    py[1] = 0.3;

   cout << "Let's MOVE and RESIZE this polygon\n" << endl;

   Polygon *polygon = new Polygon(this,1,0.2,0.4,3,px,py,"blue",0.5);
   polygon->Originate(time);
   patht = path->Interpolate(5.0);
   len = polygon->Program(time,patht);
   pathr = patht->ChangeType("RESIZE1");
   len = polygon->Program(time,pathr);
   time = Animate(time,len);

   cout << "Now let's get rid of it\n" << endl;
   polygon->Delete(time+1);
   time = Animate(time, 10);

   delete(path);
   delete(patht);
   delete(pathr);
   return(1);
}






int
Stuff::scene5()
{
   static double p1_x[111] = { 0.041494,0.012448,0.016598,0.012448,0.012448,0.008299,0.004149,0.006224,0.004149,0.006224,0.008299,0.012448,0.012448,0.012448,0.016598,0.020747,0.020747,0.020747,0.016598,0.016598,0.012448,0.016598,0.016598,0.016598,0.0124480,.012448
     ,0.016598,0.016598,0.020747,0.012448,0.012448,0.008299,0.012448,0.008299,0.008299,0.012448,0.012448,0.012448,0.016598,0.016598,0.016598,0.020747,0.024896,0.020747,0.016598,0.012448,0.012448,0.016598,0.024896,0.0124480,.016598
     ,0.012448,0.012448,0.004149,0.004149,0.002075,0.000000,-0.002075,-0.006224,-0.008299,-0.012448,-0.020747,-0.020747,-0.020747,-0.024896,-0.029046,-0.033195,-0.037344,-0.037344,-0.020747,-0.016598,-0.016598,-0.012448,-0.012448,-0.012448,-0.012448
     ,-0.016598,-0.012448,-0.016598,-0.016598,-0.058091,-0.016598,-0.012448,-0.020747,-0.016598,-0.020747,-0.020747,-0.016598,-0.020747,-0.012448,-0.012448,-0.016598,-0.008299,-0.006224,-0.008299,-0.006224,-0.012448,-0.008299,-0.008299,-0.012448,-0.008299
     ,-0.006224,-0.012448,-0.004149,-0.004149,-0.004149,-0.006224,-0.006224,-0.006224,0.000000,0.000000 };
   static double p1_y[111] = { 0.109959,0.020747,0.020747,0.020747,0.008299,0.008299,0.004149,0.004149,0.004149,0.004149,0.004149,0.004149,0.004149,0.000000,0.002075,0.000000,-0.002075,-0.004149,-0.002075,-0.006224,-0.004149,-0.006224,-0.008299,-0.012448,-0.012448,-0.016598
     ,-0.016598,-0.020747,-0.020747,-0.020747,-0.020747,-0.024896,-0.016598,-0.020747,-0.024896,-0.024896,-0.024896,-0.024896,-0.024896,-0.020747,-0.020747,-0.016598,-0.008299,-0.008299,-0.002075,0.002075,0.006224,0.016598,0.020747,0.0207470,.020747
     ,0.024896,0.029046,0.020747,0.024896,0.029046,0.033195,0.024896,0.024896,0.020747,0.016598,0.012448,0.012448,0.008299,0.006224,0.002075,0.002075,-0.002075,-0.004149,-0.008299,-0.016598,-0.016598,-0.016598,-0.024896,-0.024896,-0.024896
     ,-0.033195,-0.024896,-0.029046,-0.020747,-0.049793,-0.006224,-0.006224,-0.004149,0.000000,0.000000,0.000000,0.002075,0.002075,0.004149,0.008299,0.008299,0.008299,0.008299,0.008299,0.012448,0.012448,0.012448,0.012448,0.0082990,.008299
     ,0.006224,0.010373,0.004149,0.004149,0.000000,0.004149,0.004149,0.004149,0.002075,0.000000 };
   int len;

   cout << "Now change the background color to PapayaWhip\n" << endl;
   SetBgColor("PapayaWhip");

   cout << "Here, we use the same path in both a MOVE Action and" << endl;
   cout << "  in a FILL Action.  Notice the x-value affects the FILL.\n"
        << endl;

   cout << "And, let's Attach some text to the bottom of the rectangle\n"
        << endl;

   Rectangle *rect = new Rectangle(this, 1, 0.053942, 0.379668, 
                  0.078838, 0.080913, "orange", 0.125000);
   rect->Originate(time);

   Text *t2 = new Text(this, 1, 0.5, 0.5, "purple", "variable",
                "label", 1);
   t2->Originate(time);
   t2->AttachTo(rect, PART_N, PART_S, 0.0, 0.0);

   Action p1 = Action("MOVE", 111, p1_x, p1_y);
   Action *filler = p1.ChangeType("FILL");

   Action blue = Action("COLOR","blue");
   Action orange = Action("COLOR","orange");

   len = rect->Program(time,&p1);
   len = rect->Program(time,filler);
   time = Animate(time,len);

   len = rect->Program(time,&blue);
   time = Animate(time,len);

   len = rect->Program(time,&p1);
   len = rect->Program(time,filler);
   time = Animate(time,len);

   len = rect->Program(time,&orange);
   time = Animate(time,len);

   rect->SetCallback(animObjectCB, (void*)13);

   delete(filler);
   return(1);
}




int
Stuff::scene6()
{
   Line *l1 = new Line(this, 1, 0.188873, 0.117130, 0.000000, 0.115666, 
                    "black", 0.000000, 1.000000, 1);
   Line *l2 = new Line(this, 1, 0.243045, 0.231332, 0.000000, -0.120059, 
                    "black", 0.000000, 1.000000, 1);
   Line *l3 = new Line(this, 1, 0.286969, 0.168375, 0.077599, 0.000000, 
                    "black", 0.000000, 1.000000, 1);
   Line *l4 = new Line(this, 1, 0.489019, 0.172767, -0.067350, 0.000000, 
                    "black", 0.000000, 1.000000, 1);
   Line *a1 = new Line(this, 1, 0.188873, 0.317130, 0.000000, 0.115666, 
                    "black", 0.000000, 1.000000, 2);
   Line *a2 = new Line(this, 1, 0.243045, 0.431332, 0.000000, -0.120059, 
                    "black", 0.000000, 1.000000, 2);
   Line *a3 = new Line(this, 1, 0.286969, 0.368375, 0.077599, 0.000000, 
                    "black", 0.000000, 1.000000, 2);
   Line *a4 = new Line(this, 1, 0.489019, 0.372767, -0.067350, 0.000000, 
                    "black", 0.000000, 1.000000, 2);
   Line *r1 = new Line(this, 1, 0.188873, 0.517130, 0.000000, 0.115666, 
                    "black", 0.000000, 1.000000, 3);
   Line *r2 = new Line(this, 1, 0.243045, 0.631332, 0.000000, -0.120059, 
                    "black", 0.000000, 1.000000, 3);
   Line *r3 = new Line(this, 1, 0.286969, 0.568375, 0.077599, 0.000000, 
                    "black", 0.000000, 1.000000, 3);
   Line *r4 = new Line(this, 1, 0.489019, 0.572767, -0.067350, 0.000000, 
                    "black", 0.000000, 1.000000, 3);

   cout << "All different kinds of lines and arrows\n" << endl;

   l1->Originate(time);
   l2->Originate(time);
   l3->Originate(time);
   l4->Originate(time);
   a1->Originate(time);
   a2->Originate(time);
   a3->Originate(time);
   a4->Originate(time);
   r1->Originate(time);
   r2->Originate(time);
   r3->Originate(time);
   r4->Originate(time);
   Animate(time++,1);
   return(1);
}




int
Stuff::scene7()
{
   static double path_x[61] = { 0.000000,0.000000,-0.025460,-0.002829,-0.005658,-0.029703,-0.005658,-0.005658,0.000000,-0.005658,-0.005658,0.000000,-0.005658,-0.001414,0.007072,0.011315,0.005658,0.005658,0.011315,0.033946,0.000000,0.038190,0.016973,0.050919,0.012730,0.011315
     ,0.031117,0.015559,0.005658,0.011315,0.000000,0.002829,0.014144,0.014144,0.001414,-0.002829,0.004243,0.000000,-0.005658,-0.009901,-0.005658,-0.028289,-0.011315,0.000000,-0.026874,-0.016973,-0.001414,0.002829,0.004243,0.005658,0.000000
     ,-0.005658,-0.012730,-0.009901,-0.022631,-0.011315,-0.012730,-0.004243,-0.011315,-0.005658,-0.012730 };
   static double path_y[61] = { -0.001414,-0.002829,0.008487,-0.004243,0.001414,0.001414,0.005658,0.024045,0.008487,0.028289,0.019802,0.004243,0.029703,0.014144,0.031117,0.012730,0.018388,0.016973,0.012730,0.008487,0.007072,0.018388,0.002829,0.000000,0.000000,0.000000
     ,-0.004243,-0.002829,-0.004243,-0.016973,-0.019802,-0.015559,-0.031117,-0.045262,-0.031117,-0.014144,-0.012730,-0.025460,-0.035361,-0.035361,-0.038190,-0.012730,-0.004243,-0.004243,0.001414,0.016973,0.024045,0.025460,0.019802,0.016973,0.039604
     ,0.016973,0.016973,-0.004243,-0.005658,0.001414,-0.005658,-0.012730,-0.016973,-0.011315,-0.024045 };
   int len;

   cout << "Now let's stop that clock up in the corner\n" << endl;

   global_line->RemoveContinuous(time, global_action);

   Line *line = new Line(this, 1, 0.432815, 0.519095, 0.001414, -0.189533, 
                  "black", 0.000000, 1.000000, 3);
   line->Originate(time);
   Action path = Action("RESIZE", 61, path_x, path_y);
   len = line->Program(time,&path);
   time = Animate(time,len);
   return(1);
}



int
Stuff::scene8()
{
   static double p1_x[111] = { 0.041494,0.012448,0.016598,0.012448,0.012448,0.008299,0.004149,0.006224,0.004149,0.006224,0.008299,0.012448,0.012448,0.012448,0.016598,0.020747,0.020747,0.020747,0.016598,0.016598,0.012448,0.016598,0.016598,0.016598,0.0124480,.012448
     ,0.016598,0.016598,0.020747,0.012448,0.012448,0.008299,0.012448,0.008299,0.008299,0.012448,0.012448,0.012448,0.016598,0.016598,0.016598,0.020747,0.024896,0.020747,0.016598,0.012448,0.012448,0.016598,0.024896,0.0124480,.016598
     ,0.012448,0.012448,0.004149,0.004149,0.002075,0.000000,-0.002075,-0.006224,-0.008299,-0.012448,-0.020747,-0.020747,-0.020747,-0.024896,-0.029046,-0.033195,-0.037344,-0.037344,-0.020747,-0.016598,-0.016598,-0.012448,-0.012448,-0.012448,-0.012448
     ,-0.016598,-0.012448,-0.016598,-0.016598,-0.058091,-0.016598,-0.012448,-0.020747,-0.016598,-0.020747,-0.020747,-0.016598,-0.020747,-0.012448,-0.012448,-0.016598,-0.008299,-0.006224,-0.008299,-0.006224,-0.012448,-0.008299,-0.008299,-0.012448,-0.008299
     ,-0.006224,-0.012448,-0.004149,-0.004149,-0.004149,-0.006224,-0.006224,-0.006224,0.000000,0.000000 };
   static double p1_y[111] = { 0.109959,0.020747,0.020747,0.020747,0.008299,0.008299,0.004149,0.004149,0.004149,0.004149,0.004149,0.004149,0.004149,0.000000,0.002075,0.000000,-0.002075,-0.004149,-0.002075,-0.006224,-0.004149,-0.006224,-0.008299,-0.012448,-0.012448,-0.016598
     ,-0.016598,-0.020747,-0.020747,-0.020747,-0.020747,-0.024896,-0.016598,-0.020747,-0.024896,-0.024896,-0.024896,-0.024896,-0.024896,-0.020747,-0.020747,-0.016598,-0.008299,-0.008299,-0.002075,0.002075,0.006224,0.016598,0.020747,0.0207470,.020747
     ,0.024896,0.029046,0.020747,0.024896,0.029046,0.033195,0.024896,0.024896,0.020747,0.016598,0.012448,0.012448,0.008299,0.006224,0.002075,0.002075,-0.002075,-0.004149,-0.008299,-0.016598,-0.016598,-0.016598,-0.024896,-0.024896,-0.024896
     ,-0.033195,-0.024896,-0.029046,-0.020747,-0.049793,-0.006224,-0.006224,-0.004149,0.000000,0.000000,0.000000,0.002075,0.002075,0.004149,0.008299,0.008299,0.008299,0.008299,0.008299,0.012448,0.012448,0.012448,0.012448,0.0082990,.008299
     ,0.006224,0.010373,0.004149,0.004149,0.000000,0.004149,0.004149,0.004149,0.002075,0.000000 };
   int len;

   cout << "Text can be aligned to a lower left position" << endl;
   cout << "  or it can be centered at a position\n" << endl;
   Text *t1 = new Text(this, 1, 0.053942, 0.179668, "black", "fixed",
                "NotCentered", 0);
   t1->Originate(time);
   Action p1 = Action("MOVE", 111, p1_x, p1_y);
   len = t1->Program(time, &p1);
   time = Animate(time,len);

   Text *t2 = new Text(this, 1, 0.053942, 0.679668, "blue", "variable",
                "Centered", 1);
   t2->Originate(time);
   len = t2->Program(time, &p1);
   time = Animate(time,len);

   return(1);
}




static char data[] = {
   (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80,
   (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80,
   (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80,
   (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80,
   (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0xff, (char)0xff, (char)0xff, (char)0xff,
   (char)0xff, (char)0xff, (char)0xff, (char)0xff, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80,
   (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80,
   (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80,
   (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80,
   (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0x01, (char)0x80,
   (char)0x01, (char)0x80, (char)0x01, (char)0x80, (char)0xff, (char)0xff, (char)0xff, (char)0xff};




int
Stuff::scene9()
{
   cout << "Polka has pies and bitmaps too.  (Neat)\n" << endl;

   Pie *pie = new Pie(this, 1, 0.7, 0.2, 0.1, 0.1,0.74, "pink", 1.0);
   pie->Originate(time);

   Bitmap *b1 = new Bitmap(this,1,0.01,0.01,32,32,data,"red","yellow");
   b1->Originate(time);

   time = Animate(time, 10);
   return(10);
}




int
Stuff::scene10()
{
   int len;

   cout << "We can programmatically pan and zoom the View\n" << endl;
   Loc l1(0.5,0.2);
   Loc l2(0.3,0.2);

   Action a1("ALTER_LL", &l1, &l2, 20);
   Action a2("ALTER_UR", &l1, &l2, 20);
   len = global_line->Program(time, &a1);
   len = global_line->Program(time, &a2);
   time = Animate(time, len);
   return(1);
}


int
Stuff::scene11()
{
   double x,y;

   cout << "You can even get input!" <