Created
August 9, 2011 20:12
-
-
Save julik/1135071 to your computer and use it in GitHub Desktop.
Example for flame channel parser use
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "flame_channel_parser" | |
# Parse the setup into channels | |
channels = File.open("TW_Setup.timewarp") do | f | | |
FlameChannelParser.parse(f) | |
end | |
# Find the channel that we are interested in, in this case | |
# this is the "Timing" channel from any Timewarp setup | |
frame_channel = channels.find{|c| c.name == "Timing/Timing" } | |
# Grab the interpolator object for this channel. | |
interpolator = frame_channel.to_interpolator | |
# Now sample from frame 20 to frame 250. | |
# You can also sample at fractional frames if you want to. | |
(20..250).each do | frame_in_setup | | |
p interpolator.value_at(frame_in_setup) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment