home *** CD-ROM | disk | FTP | other *** search
/ Canadian Forces: A World of Opportunities / CanadianForces-AWorldOfOpportunities-WinMac.bin / 04_WhatOptions_FR.swf / scripts / __Packages / com / bjc / menu / BJCBounceMenu.as
Text File  |  2006-07-20  |  23KB  |  740 lines

  1. class com.bjc.menu.BJCBounceMenu extends mx.core.UIComponent
  2. {
  3.    var className = "BJCBounceMenu";
  4.    static var symbolOwner = com.bjc.menu.BJCBounceMenu;
  5.    static var symbolName = "BJCBounceMenu";
  6.    var version = "1.0.0.0";
  7.    var clipParameters = {CallBackFunction:1,Mode:1,staticItems:1,staticLinks:1,URLTgt:1,ItemPadding:1,TFclip:1,Pointer:1,StretchPointer:1,EType:1,ROSize:1,Easing:1,Speed:1,Elasticity:1,Align:1,FontSize:1,FontColor:1,FontROColor:1,FontSColor:1};
  8.    function BJCBounceMenu()
  9.    {
  10.       super();
  11.       this.w = this.__width;
  12.       this.h = this.__height;
  13.       this.id = 0;
  14.       this.a = 2;
  15.       this.totalWidth = 0;
  16.       this.totalHeight = 0;
  17.       this.createEmptyMovieClip("menuHolder",0);
  18.       this.itemStack = new Array();
  19.       this.pointer.attachMovie(this.pointerSymbol,"point",-10);
  20.       this.compIcon._visible = false;
  21.       this.pointer._visible = false;
  22.       this.menuHolder._visible = true;
  23.       if(this.menuType == "Vertical")
  24.       {
  25.          this.itemWidth = this.w;
  26.       }
  27.       else if(this.menuType == "Horizontal")
  28.       {
  29.          this.itemHeight = this.h;
  30.       }
  31.       if(this.staticItems.length > 0)
  32.       {
  33.          var _loc3_ = 0;
  34.          while(_loc3_ < this.staticItems.length)
  35.          {
  36.             this.addItem(this.staticItems[_loc3_],this.staticURLs[_loc3_]);
  37.             _loc3_ = _loc3_ + 1;
  38.          }
  39.       }
  40.    }
  41.    function init()
  42.    {
  43.       super.init();
  44.    }
  45.    function size(Void)
  46.    {
  47.       this.doLayout();
  48.       super.size();
  49.    }
  50.    function draw(Void)
  51.    {
  52.       this.size();
  53.    }
  54.    function doLayout()
  55.    {
  56.       this.w = this.__width;
  57.       this.h = this.__height;
  58.       this.compIcon._x = int(this.w / 2 - this.compIcon._width / 2);
  59.       this.compIcon._y = int(this.h / 2 - this.compIcon._height / 2);
  60.    }
  61.    function set CallBackFunction(cbf)
  62.    {
  63.       this.callBackFunction = cbf;
  64.       this.compIcon._visible = true;
  65.       this.pointer._visible = false;
  66.       this.menuHolder._visible = false;
  67.       this.invalidate();
  68.    }
  69.    function set Mode(mode)
  70.    {
  71.       this.menuType = mode;
  72.       this.invalidate();
  73.    }
  74.    function set PointerMode(mode)
  75.    {
  76.       this.pointerMode = mode;
  77.       this.invalidate();
  78.    }
  79.    function set URLTgt(ut)
  80.    {
  81.       this.URLTarget = ut;
  82.       this.invalidate();
  83.    }
  84.    function set ItemPadding(ipc)
  85.    {
  86.       this.itemPadding = ipc;
  87.       this.invalidate();
  88.    }
  89.    function set TFclip(tfc)
  90.    {
  91.       this.tfSymbol = tfc;
  92.       this.invalidate();
  93.    }
  94.    function set Pointer(point)
  95.    {
  96.       this.pointerSymbol = point;
  97.       this.invalidate();
  98.    }
  99.    function set StretchPointer(str)
  100.    {
  101.       this.stretch = str;
  102.       this.invalidate();
  103.    }
  104.    function set EType(et)
  105.    {
  106.       this.effectType = et;
  107.       this.invalidate();
  108.    }
  109.    function set RoSize(ros)
  110.    {
  111.       this.roSize = ros;
  112.       this.invalidate();
  113.    }
  114.    function set Easing(ease)
  115.    {
  116.       this.easingType = ease;
  117.       this.invalidate();
  118.    }
  119.    function set Speed(spd)
  120.    {
  121.       this.speed = spd;
  122.       this.invalidate();
  123.    }
  124.    function set Elasticity(el)
  125.    {
  126.       this.p = el;
  127.       this.invalidate();
  128.    }
  129.    function set Align(alng)
  130.    {
  131.       this.alignment = alng;
  132.       this.invalidate();
  133.    }
  134.    function set FontSize(size)
  135.    {
  136.       this.fontSize = size;
  137.       this.invalidate();
  138.    }
  139.    function set FontColor(color)
  140.    {
  141.       this.fontColor = color;
  142.       this.invalidate();
  143.    }
  144.    function set FontROColor(color)
  145.    {
  146.       this.roColor = color;
  147.       this.invalidate();
  148.    }
  149.    function set FontSColor(color)
  150.    {
  151.       this.selectedColor = color;
  152.       this.invalidate();
  153.    }
  154.    function doButtonAction(pos)
  155.    {
  156.       eval(this.callBackFunction).call(this,pos);
  157.    }
  158.    function setCallback(cb)
  159.    {
  160.       this.callBackFunction = cb;
  161.    }
  162.    function setSelected(index)
  163.    {
  164.       this.selectedItem = "item" + index;
  165.       this.selItem = eval("this.menuHolder.item" + index);
  166.       var i = 0;
  167.       while(i < this.id)
  168.       {
  169.          this.targetItem = eval("this.menuHolder.item" + i);
  170.          this.targetItem.TF.tf.textColor = this.targetItem.fontColor;
  171.          i++;
  172.       }
  173.       this.selItem.TF.tf.textColor = this.selItem.fontSColor;
  174.       if(this.selItem.URL == null)
  175.       {
  176.          this.doButtonAction(index);
  177.       }
  178.       else
  179.       {
  180.          ┬º┬ºpush(this.getURL(this.selItem.URL,this.URLTarget));
  181.       }
  182.       this.selectItem(index);
  183.    }
  184.    function addItemCustom(title, URL, urlTarget, size, fontColor, fontROColor, fontSColor)
  185.    {
  186.       this.menuHolder.createEmptyMovieClip("item" + this.id,this.id);
  187.       this.mItem = eval("this.menuHolder.item" + this.id);
  188.       this.mItem.index = this.id;
  189.       this.itemStack.push(this.mItem);
  190.       if(URL != "" && URL != null && URL != undefined)
  191.       {
  192.          this.mItem.URL = URL;
  193.          this.mItem.URLTarget = urlTarget;
  194.       }
  195.       else
  196.       {
  197.          this.mItem.URL = null;
  198.       }
  199.       this.mItem.attachMovie(this.tfSymbol,"TF",20);
  200.       if(this.id == 0)
  201.       {
  202.          this.mItem.TF.tf.textColor = fontSColor;
  203.          this.selectedItem = "item0";
  204.       }
  205.       else
  206.       {
  207.          this.mItem.TF.tf.textColor = fontColor;
  208.       }
  209.       this.mItem.ctf = new TextFormat();
  210.       this.mItem.ctf.size = size;
  211.       this.mItem.ctf.align = this.alignment;
  212.       this.mItem.TF.tf.text = title;
  213.       this.mItem.TF.tf.setTextFormat(this.mItem.ctf);
  214.       this.mItem.TF.tf.autoSize = this.alignment;
  215.       this.mItem.TF.tf.selectable = false;
  216.       if(this.menuType == "Vertical")
  217.       {
  218.          this.mItem.itemHeight = this.mItem.TF._height;
  219.          this.mItem.itemWidth = this.w;
  220.       }
  221.       else
  222.       {
  223.          this.mItem.itemWidth = this.mItem.TF._width;
  224.          this.mItem.itemHeight = this.mItem.TF._height;
  225.       }
  226.       this.mItem.fontColor = fontColor;
  227.       this.mItem.fontROColor = fontROColor;
  228.       this.mItem.fontSColor = fontSColor;
  229.       this.mItem.attachMovie("BJCMenuBox","btn",1000);
  230.       this.mItem.btn._width = this.mItem.itemWidth;
  231.       if(this.menuType == "Vertical")
  232.       {
  233.          this.mItem.btn._height = this.mItem.itemHeight;
  234.       }
  235.       else
  236.       {
  237.          this.mItem.btn._height = this.h;
  238.       }
  239.       this.mItem.btn._alpha = 0;
  240.       if(this.menuType == "Vertical")
  241.       {
  242.          if(this.alignment == "center")
  243.          {
  244.             this.mItem._x = this.itemWidth / 2;
  245.             this.mItem.TF.tf._x = (- this.mItem.TF.tf._width) / 2;
  246.             this.mItem.btn._x = (- this.itemWidth) / 2;
  247.          }
  248.          else if(this.alignment == "right")
  249.          {
  250.             this.mItem._x = this.itemWidth;
  251.             this.mItem.TF.tf._x = - this.mItem.TF.tf._width;
  252.             this.mItem.btn._x = - this.itemWidth;
  253.          }
  254.          this.mItem._y = this.totalHeight + this.mItem.itemHeight / 2;
  255.          this.mItem.TF.tf._y = (- this.mItem.itemHeight) / 2;
  256.          this.mItem.btn._y = (- this.mItem.itemHeight) / 2;
  257.          this.totalHeight += this.mItem.itemHeight + this.itemPadding;
  258.       }
  259.       else
  260.       {
  261.          if(this.alignment == "center")
  262.          {
  263.             this.mItem._x = this.totalWidth + this.mItem.itemWidth / 2;
  264.             this.mItem.TF.tf._x = (- this.mItem.TF.tf._width) / 2;
  265.             this.mItem.btn._x = (- this.mItem.itemWidth) / 2;
  266.          }
  267.          else if(this.alignment == "right")
  268.          {
  269.             this.mItem._x = this.totalWidth + this.mItem.itemWidth;
  270.             this.mItem.TF.tf._x = - this.mItem.TF.tf._width;
  271.             this.mItem.btn._x = - this.mItem.itemWidth;
  272.          }
  273.          else
  274.          {
  275.             this.mItem._x = this.totalWidth;
  276.          }
  277.          this.mItem._y = this.mItem.itemHeight / 2;
  278.          this.mItem.TF.tf._y = (- this.mItem.itemHeight) / 2;
  279.          this.mItem.btn._y = (- this.mItem.itemHeight) / 2;
  280.          this.totalWidth += this.mItem.itemWidth + this.itemPadding;
  281.       }
  282.       if(this.id == 0)
  283.       {
  284.          if(this.menuType == "Vertical")
  285.          {
  286.             if(this.stretch == "true")
  287.             {
  288.                this.pointer._height = this.mItem.itemHeight;
  289.                this.pointer._width = this.w;
  290.             }
  291.             this.pointer._y = this.mItem.itemHeight / 2;
  292.          }
  293.          else
  294.          {
  295.             if(this.stretch == "true")
  296.             {
  297.                this.pointer._height = this.h;
  298.                this.pointer._width = this.mItem.itemWidth;
  299.             }
  300.             this.pointer._x = this.mItem.itemWidth / 2;
  301.          }
  302.       }
  303.       this.mItem.btn.onRelease = function()
  304.       {
  305.          this._parent._parent._parent.selectedItem = this._parent._name;
  306.          var i = 0;
  307.          while(i < this._parent._parent._parent.id)
  308.          {
  309.             this.targetItem = eval("this._parent._parent.item" + i);
  310.             this.targetItem.TF.tf.textColor = this.targetItem.fontColor;
  311.             i++;
  312.          }
  313.          this._parent.TF.tf.textColor = this._parent.fontSColor;
  314.          if(this._parent.URL == null)
  315.          {
  316.             this._parent._parent._parent.doButtonAction(this._parent.index);
  317.          }
  318.          else
  319.          {
  320.             ┬º┬ºpush(this.getURL(this._parent.URL,this._parent.URLTarget));
  321.          }
  322.          this._parent._parent._parent.selectItem(this._parent.index);
  323.       };
  324.       this.mItem.btn.onRollOver = function()
  325.       {
  326.          this._parent.TF.tf.textColor = this._parent.fontROColor;
  327.          this._parent._parent._parent.rollOverItem(this._parent.index);
  328.          this._parent._parent._parent.swapItems(this._parent._name);
  329.       };
  330.       this.mItem.btn.onRollOut = function()
  331.       {
  332.          if(this._parent._parent._parent.selectedItem == this._parent._name)
  333.          {
  334.             this._parent.TF.tf.textColor = this._parent.fontSColor;
  335.          }
  336.          else
  337.          {
  338.             this._parent.TF.tf.textColor = this._parent.fontColor;
  339.          }
  340.          this._parent._parent._parent.rollOutItem(this._parent.index);
  341.       };
  342.       this.mItem.btn.onReleaseOutside = this.mItem.btn.onRollOut;
  343.       this.pointer._visible = true;
  344.       this.id = this.id + 1;
  345.       return this.id - 1;
  346.    }
  347.    function addItem(title, URL)
  348.    {
  349.       return this.addItemCustom(title,URL,this.URLTarget,this.fontSize,this.fontColor,this.roColor,this.selectedColor);
  350.    }
  351.    function clearMenu()
  352.    {
  353.       clearInterval(this.pointer.pointerIVal);
  354.       var i = 0;
  355.       while(i < this.itemStack.length)
  356.       {
  357.          this.targetItem = eval("this.menuHolder.item" + i);
  358.          clearInterval(this.targetItem.itemIVal);
  359.          i++;
  360.       }
  361.       this.itemStack = new Array();
  362.       this.createEmptyMovieClip("menuHolder",0);
  363.       this.id = 0;
  364.       this.totalWidth = 0;
  365.       this.totalHeight = 0;
  366.       this.rollOverItem(0);
  367.       this.pointer._visible = false;
  368.       if(this.menuType == "Vertical")
  369.       {
  370.          this.pointer._y = 0;
  371.       }
  372.       else
  373.       {
  374.          this.pointer._x = 0;
  375.       }
  376.    }
  377.    function swapItems(item)
  378.    {
  379.       this.topItem = this.menuHolder[item];
  380.       var _loc2_ = 0;
  381.       while(_loc2_ < this.itemStack.length)
  382.       {
  383.          if(this.itemStack[_loc2_] == this.topItem)
  384.          {
  385.             this.zPos = _loc2_;
  386.          }
  387.          _loc2_ = _loc2_ + 1;
  388.       }
  389.       _loc2_ = this.zPos;
  390.       while(_loc2_ < this.itemStack.length - 1)
  391.       {
  392.          var _loc4_ = this.itemStack[_loc2_];
  393.          var _loc3_ = this.itemStack[_loc2_ + 1];
  394.          this.itemStack[_loc2_].swapDepths(this.itemStack[_loc2_ + 1]);
  395.          this.itemStack[_loc2_] = _loc3_;
  396.          this.itemStack[_loc2_ + 1] = _loc4_;
  397.          _loc2_ = _loc2_ + 1;
  398.       }
  399.    }
  400.    function rollOverItem(index)
  401.    {
  402.       if(this.pointerMode == "onRollOver" && this.targetItem != eval("this.menuHolder.item" + index))
  403.       {
  404.          this.targetItem = eval("this.menuHolder.item" + index);
  405.          if(this.menuType == "Vertical")
  406.          {
  407.             this.pointer.tcounter = 0;
  408.             this.pointer.startPosition = this.pointer._y;
  409.             this.pointer.targetPosition = this.targetItem._y - this.pointer._y;
  410.             this.pointer.startSize = this.pointer._height;
  411.             this.pointer.targetSize = this.targetItem.itemHeight - this.pointer._height;
  412.             clearInterval(this.pointer.pointerIVal);
  413.             this.pointer.pointerIVal = setInterval(this,"movePointer",30);
  414.          }
  415.          else
  416.          {
  417.             this.pointer.tcounter = 0;
  418.             this.pointer.startPosition = this.pointer._x;
  419.             this.pointer.targetPosition = this.targetItem._x - this.pointer._x + this.targetItem.itemWidth / 2;
  420.             if(this.alignment == "center")
  421.             {
  422.                this.pointer.targetPosition -= this.targetItem.itemWidth / 2;
  423.             }
  424.             else if(this.alignment == "right")
  425.             {
  426.                this.pointer.targetPosition -= this.targetItem.itemWidth;
  427.             }
  428.             this.pointer.startSize = this.pointer._width;
  429.             this.pointer.targetSize = this.targetItem.itemWidth - this.pointer._width;
  430.             clearInterval(this.pointer.pointerIVal);
  431.             this.pointer.pointerIVal = setInterval(this,"movePointer",30);
  432.          }
  433.       }
  434.       this.targetItem = eval("this.menuHolder.item" + index);
  435.       if(this.effectType == "scale")
  436.       {
  437.          this.targetItem.tcounter = 0;
  438.          this.targetItem.startPosition = this.targetItem.TF._yscale;
  439.          this.targetItem.targetPosition = this.roSize - this.targetItem.TF._yscale;
  440.       }
  441.       else if(this.effectType == "move")
  442.       {
  443.          this.targetItem.tcounter = 0;
  444.          if(this.menuType == "Vertical")
  445.          {
  446.             if(this.alignment == "left")
  447.             {
  448.                this.targetItem.startPosition = this.targetItem.TF._x;
  449.                this.targetItem.targetPosition = this.itemWidth - this.targetItem.TF._width;
  450.             }
  451.             else if(this.alignment == "right")
  452.             {
  453.                this.targetItem.startPosition = this.targetItem.TF._x;
  454.                this.targetItem.targetPosition = this.targetItem.TF._width - this.targetItem.TF._x - this.itemWidth;
  455.             }
  456.          }
  457.          else
  458.          {
  459.             this.targetItem.startPosition = this.targetItem.TF._y;
  460.             this.targetItem.targetPosition = this.itemHeight - this.targetItem.itemHeight - this.targetItem.TF._y;
  461.          }
  462.       }
  463.       clearInterval(this.targetItem.itemIVal);
  464.       this.targetItem.itemIVal = setInterval(this,"moveItem",30,this.targetItem);
  465.    }
  466.    function rollOutItem(index)
  467.    {
  468.       this.targetItem = eval("this.menuHolder.item" + index);
  469.       if(this.effectType == "scale")
  470.       {
  471.          this.targetItem.tcounter = 0;
  472.          this.targetItem.startPosition = this.targetItem.TF._yscale;
  473.          this.targetItem.targetPosition = 100 - this.targetItem.TF._yscale;
  474.       }
  475.       else if(this.effectType == "move")
  476.       {
  477.          this.targetItem.tcounter = 0;
  478.          if(this.menuType == "Vertical")
  479.          {
  480.             if(this.alignment == "left")
  481.             {
  482.                this.targetItem.startPosition = this.targetItem.TF._x;
  483.                this.targetItem.targetPosition = - this.targetItem.TF._x;
  484.             }
  485.             else if(this.alignment == "right")
  486.             {
  487.                this.targetItem.startPosition = this.targetItem.TF._x;
  488.                this.targetItem.targetPosition = - this.targetItem.TF._x;
  489.             }
  490.          }
  491.          else
  492.          {
  493.             this.targetItem.startPosition = this.targetItem.TF._y;
  494.             this.targetItem.targetPosition = - this.targetItem.TF._y;
  495.          }
  496.       }
  497.       clearInterval(this.targetItem.itemIVal);
  498.       this.targetItem.itemIVal = setInterval(this,"moveItem",30,this.targetItem);
  499.    }
  500.    function selectItem(index)
  501.    {
  502.       this.targetItem = eval("this.menuHolder.item" + index);
  503.       if(this.pointerMode == "onClick")
  504.       {
  505.          if(this.menuType == "Vertical")
  506.          {
  507.             this.pointer.tcounter = 0;
  508.             this.pointer.startPosition = this.pointer._y;
  509.             this.pointer.targetPosition = this.targetItem._y - this.pointer._y;
  510.             this.pointer.startSize = this.pointer._height;
  511.             this.pointer.targetSize = this.targetItem.itemHeight - this.pointer._height;
  512.             clearInterval(this.pointer.pointerIVal);
  513.             this.pointer.pointerIVal = setInterval(this,"movePointer",30);
  514.          }
  515.          else
  516.          {
  517.             this.pointer.tcounter = 0;
  518.             this.pointer.startPosition = this.pointer._x;
  519.             this.pointer.targetPosition = this.targetItem._x - this.pointer._x + this.targetItem.itemWidth / 2;
  520.             if(this.alignment == "center")
  521.             {
  522.                this.pointer.targetPosition -= this.targetItem.itemWidth / 2;
  523.             }
  524.             else if(this.alignment == "right")
  525.             {
  526.                this.pointer.targetPosition -= this.targetItem.itemWidth;
  527.             }
  528.             this.pointer.startSize = this.pointer._width;
  529.             this.pointer.targetSize = this.targetItem.itemWidth - this.pointer._width;
  530.             clearInterval(this.pointer.pointerIVal);
  531.             this.pointer.pointerIVal = setInterval(this,"movePointer",30);
  532.          }
  533.       }
  534.    }
  535.    function moveItem(item)
  536.    {
  537.       if(item.tcounter < this.speed)
  538.       {
  539.          item.tcounter = item.tcounter + 1;
  540.          if(this.effectType == "scale")
  541.          {
  542.             item.TF._yscale = this.doTransition(item.tcounter,item.startPosition,item.targetPosition,this.speed,this.a,this.p);
  543.             item.TF._xscale = item.TF._yscale;
  544.          }
  545.          else if(this.effectType == "move")
  546.          {
  547.             if(this.menuType == "Vertical")
  548.             {
  549.                item.TF._x = this.doTransition(item.tcounter,item.startPosition,item.targetPosition,this.speed,this.a,this.p);
  550.             }
  551.             else
  552.             {
  553.                item.TF._y = this.doTransition(item.tcounter,item.startPosition,item.targetPosition,this.speed,this.a,this.p);
  554.             }
  555.          }
  556.       }
  557.       else
  558.       {
  559.          clearInterval(item.itemIVal);
  560.          item.tcounter = 0;
  561.       }
  562.    }
  563.    function movePointer()
  564.    {
  565.       if(this.pointer.tcounter < this.speed)
  566.       {
  567.          this.pointer.tcounter = this.pointer.tcounter + 1;
  568.          if(this.menuType == "Vertical")
  569.          {
  570.             if(this.stretch == "true")
  571.             {
  572.                this.pointer._height = this.doTransition(this.pointer.tcounter,this.pointer.startSize,this.pointer.targetSize,this.speed,this.a,this.p);
  573.             }
  574.             this.pointer._y = this.doTransition(this.pointer.tcounter,this.pointer.startPosition,this.pointer.targetPosition,this.speed,this.a,this.p);
  575.          }
  576.          else
  577.          {
  578.             if(this.stretch == "true")
  579.             {
  580.                this.pointer._width = this.doTransition(this.pointer.tcounter,this.pointer.startSize,this.pointer.targetSize,this.speed,this.a,this.p);
  581.             }
  582.             this.pointer._x = this.doTransition(this.pointer.tcounter,this.pointer.startPosition,this.pointer.targetPosition,this.speed,this.a,this.p);
  583.          }
  584.       }
  585.       else
  586.       {
  587.          clearInterval(this.pointer.pointerIVal);
  588.          this.pointer.tcounter = 0;
  589.       }
  590.    }
  591.    function doTransition(t, b, c, d, a, p)
  592.    {
  593.       switch(this.easingType)
  594.       {
  595.          case "easingUp":
  596.             return this.easeIn(t,b,c,d);
  597.          case "easingDown":
  598.             return this.easeOut(t,b,c,d);
  599.          case "easingUpDown":
  600.             return this.easeInOut(t,b,c,d);
  601.          case "elasticUp":
  602.             return this.elasticIn(t,b,c,d,a,p);
  603.          case "elasticDown":
  604.             return this.elasticOut(t,b,c,d,a,p);
  605.          case "elasticUpDown":
  606.             return this.elasticInOut(t,b,c,d,a,p);
  607.          case "bounceUp":
  608.             return this.bounceIn(t,b,c,d);
  609.          case "bounceDown":
  610.             return this.bounceOut(t,b,c,d);
  611.          case "bounceUpDown":
  612.             return this.bounceInOut(t,b,c,d);
  613.          default:
  614.       }
  615.    }
  616.    function easeIn(t, b, c, d)
  617.    {
  618.       return c * (t /= d) * t + b;
  619.    }
  620.    function easeOut(t, b, c, d)
  621.    {
  622.       return (- c) * (t /= d) * (t - 2) + b;
  623.    }
  624.    function easeInOut(t, b, c, d)
  625.    {
  626.       if((t /= d / 2) < 1)
  627.       {
  628.          return c / 2 * t * t + b;
  629.       }
  630.       return (- c) / 2 * ((t = t - 1) * (t - 2) - 1) + b;
  631.    }
  632.    function elasticIn(t, b, c, d, a, p)
  633.    {
  634.       if(t == 0)
  635.       {
  636.          return b;
  637.       }
  638.       if((t /= d) == 1)
  639.       {
  640.          return b + c;
  641.       }
  642.       if(!p)
  643.       {
  644.          p = d * 0.3;
  645.       }
  646.       if(!a || a < Math.abs(c))
  647.       {
  648.          a = c;
  649.          var _loc7_ = p / 4;
  650.       }
  651.       else
  652.       {
  653.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  654.       }
  655.       return - a * Math.pow(2,10 * (t -= 1)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p) + b;
  656.    }
  657.    function elasticOut(t, b, c, d, a, p)
  658.    {
  659.       if(t == 0)
  660.       {
  661.          return b;
  662.       }
  663.       if((t /= d) == 1)
  664.       {
  665.          return b + c;
  666.       }
  667.       if(!p)
  668.       {
  669.          p = d * 0.3;
  670.       }
  671.       if(!a || a < Math.abs(c))
  672.       {
  673.          a = c;
  674.          var _loc7_ = p / 4;
  675.       }
  676.       else
  677.       {
  678.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  679.       }
  680.       return a * Math.pow(2,-10 * t) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p) + c + b;
  681.    }
  682.    function elasticInOut(t, b, c, d, a, p)
  683.    {
  684.       if(t == 0)
  685.       {
  686.          return b;
  687.       }
  688.       if((t /= d / 2) == 2)
  689.       {
  690.          return b + c;
  691.       }
  692.       if(!p)
  693.       {
  694.          p = d * 0.44999999999999996;
  695.       }
  696.       if(!a || a < Math.abs(c))
  697.       {
  698.          a = c;
  699.          var _loc7_ = p / 4;
  700.       }
  701.       else
  702.       {
  703.          _loc7_ = p / 6.283185307179586 * Math.asin(c / a);
  704.       }
  705.       if(t < 1)
  706.       {
  707.          return -0.5 * (a * Math.pow(2,10 * (t -= 1)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p)) + b;
  708.       }
  709.       return a * Math.pow(2,-10 * (t -= 1)) * Math.sin((t * d - _loc7_) * 6.283185307179586 / p) * 0.5 + c + b;
  710.    }
  711.    function bounceIn(t, b, c, d)
  712.    {
  713.       return c - this.bounceOut(d - t,0,c,d) + b;
  714.    }
  715.    function bounceOut(t, b, c, d)
  716.    {
  717.       if((t /= d) < 0.36363636363636365)
  718.       {
  719.          return c * (7.5625 * t * t) + b;
  720.       }
  721.       if(t < 0.7272727272727273)
  722.       {
  723.          return c * (7.5625 * (t -= 0.5454545454545454) * t + 0.75) + b;
  724.       }
  725.       if(t < 0.9090909090909091)
  726.       {
  727.          return c * (7.5625 * (t -= 0.8181818181818182) * t + 0.9375) + b;
  728.       }
  729.       return c * (7.5625 * (t -= 0.9545454545454546) * t + 0.984375) + b;
  730.    }
  731.    function bounceInOut(t, b, c, d)
  732.    {
  733.       if(t < d / 2)
  734.       {
  735.          return this.bounceIn(t * 2,0,c,d) * 0.5 + b;
  736.       }
  737.       return this.bounceOut(t * 2 - d,0,c,d) * 0.5 + c * 0.5 + b;
  738.    }
  739. }
  740.