text: /*
   * Tangram
   * Copyright 2010 Baidu Inc. All rights reserved.
   * 
   * @author: meizz
   * @create: 2010-07-15
   * @namespace: baidu.fx.getTransition
   */
  
  ///import baidu.fx;
  
  
  /**
   * 获取线型函数
   * @function
   * @grammar baidu.fx.getTransition(name)
   * @param   {String}    name    transition的名称
   * @return  {function}          线型函数
   */
  baidu.fx.getTransition = function(name) {
      var a = baidu.fx.transitions;
      if (!name || typeof a[name] != "string") name = "linear";
      return new Function("percent", a[name]);
  };
  
  baidu.fx.transitions = {
      none : "return 0"
      ,full : "return 1"
      ,linear : "return percent"  // 斜线
      ,reverse : "return 1 - percent" // 反斜线
      ,parabola : "return Math.pow(percent, 2)"   // 抛物线
      ,antiparabola : "return 1 - Math.pow(1 - percent, 2)"   // 反抛物线
      ,sinoidal : "return (-Math.cos(percent * Math.PI)/2) + 0.5" // 正弦波
      ,wobble : "return (-Math.cos(percent * Math.PI * (9 * percent))/2) + 0.5"   // 摇晃
      ,spring : "return 1 - (Math.cos(percent * 4.5 * Math.PI) * Math.exp(-percent * 6))" // 弹性阴尼
  };
  
  /*
  //from: http://github.com/madrobby/scriptaculous/blob/master/src/effects.js
  
  Transitions: {
      linear: Prototype.K,
      sinoidal: function(pos) {
        return (-Math.cos(pos*Math.PI)/2) + .5;
      },
      reverse: function(pos) {
        return 1-pos;
      },
      flicker: function(pos) {
        var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
        return pos > 1 ? 1 : pos;
      },
      wobble: function(pos) {
        return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
      },
      pulse: function(pos, pulses) {
        return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
      },
      spring: function(pos) {
        return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
      },
      none: function(pos) {
        return 0;
      },
      full: function(pos) {
        return 1;
      }
  }
  
  Fx.Transitions.extend({
  
  	Pow: function(p, x){
  		return Math.pow(p, x[0] || 6);
  	},
  
  	Expo: function(p){
  		return Math.pow(2, 8 * (p - 1));
  	},
  
  	Circ: function(p){
  		return 1 - Math.sin(Math.acos(p));
  	},
  
  	Sine: function(p){
  		return 1 - Math.sin((1 - p) * Math.PI / 2);
  	},
  
  	Back: function(p, x){
  		x = x[0] || 1.618;
  		return Math.pow(p, 2) * ((x + 1) * p - x);
  	},
  
  	Bounce: function(p){
  		var value;
  		for (var a = 0, b = 1; 1; a += b, b /= 2){
  			if (p >= (7 - 4 * a) / 11){
  				value = b * b - Math.pow((11 - 6 * a - 11 * p) / 4, 2);
  				break;
  			}
  		}
  		return value;
  	},
  
  	Elastic: function(p, x){
  		return Math.pow(2, 10 * --p) * Math.cos(20 * p * Math.PI * (x[0] || 1) / 3);
  	}
  
  });
  
  ['Quad', 'Cubic', 'Quart', 'Quint'].each(function(transition, i){
  	Fx.Transitions[transition] = new Fx.Transition(function(p){
  		return Math.pow(p, [i + 2]);
  	});
  });
  
  
  //*/
  