Einzelnen Beitrag anzeigen
Alt 05-12-2003, 01:39   #13 (permalink)
michael
nerdig working
 
Benutzerbild von michael
 
Registriert seit: Jul 2001
Ort: Hamburg
Beiträge: 5.832
ich lass es mal mitschneien
ActionScript:
  1. function Snow (targetMc, size, speed, count, width, height)
  2. {
  3.     this.targetMc = targetMc;
  4.     this.size = size;
  5.     this.speed = speed;
  6.     this.count = count;
  7.     this.width = width;
  8.     this.height = height;
  9.     this.flakes = [];
  10.     this.makeFlakes ();
  11. }
  12. Snow.prototype.makeFlakes = function ()
  13. {
  14.     for (var i = 0; i < this.count; i++)
  15.     {
  16.         var flake = this.targetMc.createEmptyMovieClip ("f" + i, i + 1);
  17.         this.flakes.push ({mc:flake, dist:5 + Math.random () * 5});
  18.         with (flake)
  19.         {
  20.             _y = Math.random () * this.height;
  21.             _x = Math.random () * this.width;
  22.             lineStyle (4, 0xEEEEEE);
  23.             lineTo (1, 1);
  24.         }
  25.     }
  26.     this.snowID = setInterval (this, "render", this.speed);
  27. };
  28. Snow.prototype.render = function ()
  29. {
  30.     this.xpos++;
  31.     for (var i = 0; i < this.count; i++)
  32.     {
  33.         this.flakes[i].mc._y += this.flakes[i].dist;
  34.         this.flakes[i].mc._x += Math.sin (i + this.xpos / 5) * 5;
  35.         if (this.flakes[i].mc._y > this.height)
  36.         {
  37.             this.flakes[i].mc._y = this.size * -1;
  38.             this.flakes[i].mc._x = Math.random () * this.width;
  39.         }
  40.     }
  41. };
  42. this.createEmptyMovieClip ("snow_mc", 1);
  43. test = new Snow (snow_mc, 4, 20, 100, 550, 400);
  44. _quality = "LOW";
michael ist offline   Mit Zitat antworten