// Linear and non-linear calculations for animation - From http://www.robertpenner.com/easing/
//
// t = time, b = begin, e = end, d = duration
function linear(t, b, e, d) {
  c = e - b;
  return c*t/d + b;
}

function sineInOut(t, b, e, d) {
  c = e - b;
  return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
}

function cubicIn(t, b, e, d) {
  c = e - b;
  return c*(t/=d)*t*t + b;
}

function cubicOut(t, b, e, d) {
  c = e - b;
  return c*((t=t/d-1)*t*t + 1) + b;
}

function cubicInOut(t, b, e, d) {
  c = e - b;
  if ((t/=d/2) < 1) return c/2*t*t*t + b;
  return c/2*((t-=2)*t*t + 2) + b;
}
