Sha256: 96154fa99f64cddd6fb19eb47ac4348820c929d3bbe5681bc68d43c5b523176e

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 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

4 entries across 4 versions & 1 rubygems

Version Path
interpolate-0.2.4 examples/arrays.rb
interpolate-0.2.1 examples/arrays.rb
interpolate-0.2.0 examples/arrays.rb
interpolate-0.2.2 examples/arrays.rb