Sha256: 1f33b15455fad960df3bbf682c98fd268b5854e8c47bea9b1ed43f66917bb42a
Contents?: true
Size: 710 Bytes
Versions: 1
Compression:
Stored size: 710 Bytes
Contents
require 'rubygems' require 'interpolate' require 'pp' # a number of sets 2D vertices, each set corresponding to a particular # shape on the grid time_frames = { 0 => [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]], # a horizontal line 1 => [[0, 0], [1, 0], [3, 0], [0, 4], [0, 0]], # a triangle 2 => [[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]], # a square 3 => [[0, 0], [1, 0], [2, 0], [3, 0], [4, 0]], # a horizontal line, again 4 => [[0, 0], [0, 1], [0, 2], [0, 3], [0, 4]] # a vertical line } paths = Interpolate::Points.new(time_frames) # show the vertex positions in time increments of 0.25 (0).step(4, 0.25) do |time| points = paths.at(time) puts ">> At #{time}s, points are:" p points end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
interpolate-0.3.0 | examples/nested.rb |