Sha256: 1cb2cc0bd0b488ed58d784180880e7b6cfb34f3176dffb61ebfe49381f1a9724

Contents?: true

Size: 517 Bytes

Versions: 1

Compression:

Stored size: 517 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 = Interpolate::Points.new(time_frames)

# play the actor's 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.3.0 examples/arrays.rb