Method: Bayonetta::ExpKeyInterpolate#interpolate

Defined in:
lib/bayonetta/exp.rb

#interpolate(position) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/bayonetta/exp.rb', line 58

def interpolate(position)
  if positions <= key_positions.first
    get_p(0)
  elsif positions >= key_positions.last
    get_p(key_positions.length -1)
  else
    key_positions.each_cons(2).each_with_index { |(start, stop), i|
      if position <= stop && position >= start
        return interpol(position, start, stop)
      end
    }
  end
end