home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / starisland.swf / scripts / __Packages / org / cove / flade / primitives / RimParticle.as < prev    next >
Encoding:
Text File  |  2007-12-10  |  1.4 KB  |  50 lines

  1. class org.cove.flade.primitives.RimParticle
  2. {
  3.    var curr;
  4.    var prev;
  5.    var vs;
  6.    var speed;
  7.    var maxTorque;
  8.    var wr;
  9.    function RimParticle(r, mt)
  10.    {
  11.       this.curr = new org.cove.flade.util.Vector(r,0);
  12.       this.prev = new org.cove.flade.util.Vector(0,0);
  13.       this.vs = 0;
  14.       this.speed = 0;
  15.       this.maxTorque = mt;
  16.       this.wr = r;
  17.    }
  18.    function verlet(sysObj)
  19.    {
  20.       this.speed = Math.max(- this.maxTorque,Math.min(this.maxTorque,this.speed + this.vs));
  21.       var _loc3_ = - this.curr.y;
  22.       var _loc2_ = this.curr.x;
  23.       var _loc4_ = Math.sqrt(_loc3_ * _loc3_ + _loc2_ * _loc2_);
  24.       _loc3_ /= _loc4_;
  25.       _loc2_ /= _loc4_;
  26.       this.curr.x += this.speed * _loc3_;
  27.       this.curr.y += this.speed * _loc2_;
  28.       var _loc10_ = this.prev.x;
  29.       var _loc9_ = this.prev.y;
  30.       var _loc0_ = null;
  31.       var _loc8_ = this.prev.x = this.curr.x;
  32.       var _loc0_ = null;
  33.       var _loc7_ = this.prev.y = this.curr.y;
  34.       this.curr.x += sysObj.coeffDamp * (_loc8_ - _loc10_);
  35.       this.curr.y += sysObj.coeffDamp * (_loc7_ - _loc9_);
  36.       var _loc6_ = Math.sqrt(this.curr.x * this.curr.x + this.curr.y * this.curr.y);
  37.       var _loc5_ = (_loc6_ - this.wr) / _loc6_;
  38.       this.curr.x -= this.curr.x * _loc5_;
  39.       this.curr.y -= this.curr.y * _loc5_;
  40.    }
  41.    function GetRadius()
  42.    {
  43.       return this.wr;
  44.    }
  45.    function SetRadius(r)
  46.    {
  47.       this.wr = r;
  48.    }
  49. }
  50.