Module: Moon::Easing::ExponentialInOut

Defined in:
lib/moon/packages/std/animation/easing.rb

Class Method Summary collapse

Class Method Details

.call(k) ⇒ Object


129
130
131
132
133
134
135
136
137
138
139
# File 'lib/moon/packages/std/animation/easing.rb', line 129

def self.call(k)
  if (k == 0)
    0
  elsif (k == 1)
    1
  elsif ((k *= 2) < 1)
    0.5 * 1024 ** (k - 1)
  else
    0.5 * (-(2 ** (-10 * (k - 1))) + 2)
  end
end