Sha256: 87afc270543644b77627793fd0127a94ffe3652630da181dd5add7664aa6222d

Contents?: true

Size: 509 Bytes

Versions: 1

Compression:

Stored size: 509 Bytes

Contents

require 'rubygems'
require 'interpolate'
require 'pp'

# a non-linear set of multi-dimensional points;
# perhaps the location of some actor in relation to time
time_frames = {
  0 => [0, 0, 0],
  1 => [1, 0, 0],
  2 => [0, 1, 0],
  3 => [0, 0, 2],
  4 => [3, 0, 1],
  5 => [1, 2, 3],
  6 => [0, 0, 0]
}

path = Interpolation.new(time_frames)

# play the actors positions in time increments of 0.25
(0).step(6, 0.25) do |time|
  position = path.at(time)
  puts ">> At #{time}s, actor is at:"
  p position
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
interpolate-0.2.3 examples/arrays.rb