Class: FlameChannelParser::FramecurveWriters::SoftfxTimewarp

Inherits:
Base
  • Object
show all
Defined in:
lib/framecurve_writers/softfx_timewarp.rb

Overview

Writes out a framecurve setup

Direct Known Subclasses

BatchTimewarp, Kronos

Constant Summary collapse

DATETIME_FORMAT =
'%a %b %d %H:%M:%S %Y'
TIME =
Time.local(2011,12,28,14,50,05)

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited, #run_export_from_framecurve, with_each_writer

Class Method Details

.extensionObject



6
7
8
# File 'lib/framecurve_writers/softfx_timewarp.rb', line 6

def self.extension
  '.timewarp'
end

Instance Method Details

#run_export(io) {|writer| ... } ⇒ Object

Yields:

  • (writer)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/framecurve_writers/softfx_timewarp.rb', line 10

def run_export(io)
  w = FlameChannelParser::Builder.new(io)
  
  w.timewarp_file_version "1.0"
  w.creation_date(TIME.strftime(DATETIME_FORMAT))
  w.linebreak(2)
  w.fields 0
  w.origin 1
  w.render_type false
  w.sampling_step 0
  w.interpolation 0
  w.flow_quality 0
  w.linebreak!(2)
  
  # Accumulate all the keys
  writer = KeyWriter.new
  yield(writer)
  speeds = generate_speed(writer.keys)
  
  # Compute intermediate frames and speeds
  w.animation do | anim |
    anim.channel("Speed") do | speed | 
      write_animation(speeds, speed, :constant)
    end
    anim.channel("Timing/Timing") do | c |
      write_animation(writer.keys, c, :linear)
    end
  end
  
end