Module: Tween::Expo::InOut

Defined in:
lib/tween.rb

Class Method Summary collapse

Class Method Details

.ease(t, st, ch, d) ⇒ Object



214
215
216
217
218
219
220
221
222
223
224
# File 'lib/tween.rb', line 214

def self.ease(t, st, ch, d)
  if t == 0
    st
  elsif t == d
    st + ch
  elsif (t /= d / 2.0) < 1
    ch / 2.0 * (2 ** (10 * (t - 1))) + st
  else
    ch / 2.0 * (-(2 ** (-10 * (t -= 1))) + 2) + st
  end
end