PERL   56

sparks orig cgi

Guest on 3rd July 2022 05:09:32 PM

  1. #!/usr/bin/perl -w
  2. use strict;
  3.  
  4. use SWF qw(:ALL);
  5. use SWF::Constants qw(:Fill);
  6.  
  7. my $m = new SWF::Movie();
  8. $m->setDimension(320, 240);
  9. $m->setBackground(0x00, 0x00, 0x00);
  10.  
  11. $m->add(new SWF::Action("
  12.  
  13. _quality = 'LOW';
  14. frames._visible = false;
  15. sparks = [];
  16.  
  17.  "));
  18.  
  19. my $g = new SWF::Gradient();
  20. $g->addEntry(0, 0xff, 0xff, 0xff, 0xff);
  21. $g->addEntry(0.1, 0xff, 0xff, 0xff, 0xff);
  22. $g->addEntry(0.5, 0xff, 0xff, 0xff, 0x5f);
  23. $g->addEntry(1.0, 0xff, 0xff, 0xff, 0);
  24.  
  25. # gradient shape thing
  26. my $s = new SWF::Shape();
  27. my $f = $s->addFill($g, SWFFILL_RADIAL_GRADIENT);
  28. $f->scaleTo(0.03);
  29. $s->setRightFill($f);
  30. $s->movePenTo(-30, -30);
  31. $s->drawLine(60, 0);
  32. $s->drawLine(0, 60);
  33. $s->drawLine(-60, 0);
  34. $s->drawLine(0, -60);
  35.  
  36. # need to make this a sprite so we can multColor it
  37. my $p = new SWF::Sprite();
  38. $p->add($s);
  39. $p->nextFrame();
  40.  
  41. # put the shape in here, each frame a different color
  42. my $q = new SWF::Sprite();
  43. $q->add(new SWF::Action("gotoFrame(random(7)+1); stop();"));
  44. my $i = $q->add($p);
  45.  
  46. $i->multColor(1.0, 1.0, 1.0);
  47. $q->nextFrame();
  48. $i->multColor(1.0, 0.5, 0.5);
  49. $q->nextFrame();
  50. $i->multColor(1.0, 0.75, 0.5);
  51. $q->nextFrame();
  52. $i->multColor(1.0, 1.0, 0.5);
  53. $q->nextFrame();
  54. $i->multColor(0.5, 1.0, 0.5);
  55. $q->nextFrame();
  56. $i->multColor(0.5, 0.5, 1.0);
  57. $q->nextFrame();
  58. $i->multColor(1.0, 0.5, 1.0);
  59. $q->nextFrame();
  60.  
  61. # finally, this one contains the action code
  62. $p = new SWF::Sprite();
  63. $i = $p->add($q);
  64. $i->setName('frames');
  65. $p->add(new SWF::Action("
  66.  
  67. dx = _root.dx/3 + random(10)-5;
  68. dy = _root.dy/3;
  69. x = _root._xmouse;
  70. y = _root._ymouse;
  71. alpha = 100;
  72.  
  73.  "));
  74. $p->nextFrame();
  75.  
  76. $p->add(new SWF::Action("
  77.  
  78. this._x = x;
  79. this._y = y;
  80. this._alpha = alpha;
  81. x += dx;
  82. y += dy;
  83. dy += 3;
  84. alpha -= 8;
  85.  
  86.  "));
  87. $p->nextFrame();
  88.  
  89. $p->add(new SWF::Action("prevFrame(); play();"));
  90. $p->nextFrame();
  91.  
  92. $i = $m->add($p);
  93. $i->setName('frames');
  94. $m->nextFrame();
  95.  
  96. $m->add(new SWF::Action("
  97.  
  98. dx = _xmouse - lastx;
  99. dy = _ymouse - lasty;
  100.  
  101. lastx = _xmouse;
  102. lasty = _ymouse;
  103.  
  104. if(++num == 11)
  105.  num = 1;
  106.  
  107. if(sparks[num])
  108.  removeMovieClip(sparks[num]);
  109.  
  110. duplicateMovieClip('frames', 'char'+num, num);
  111. sparks[num] = this['char'+num];
  112.  
  113.  "));
  114.  
  115. $m->nextFrame();
  116. $m->add(new SWF::Action("prevFrame(); play();"));
  117.  
  118. print "Content-type: application/x-shockwave-flash\n\n";
  119.  
  120. $m->output();

Raw Paste


Login or Register to edit or fork this paste. It's free.