Class: AnimateIt::Tracks::Recorder

Inherits:
Object
  • Object
show all
Defined in:
lib/animate_it/tracks/recorder.rb

Overview

Samples declared variable/text tracks and serializes compact keyframes.

Constant Summary collapse

ANIMATE_GROUP =
"animate".freeze

Instance Method Summary collapse

Constructor Details

#initialize(composition, props: {}) ⇒ Recorder

Returns a new instance of Recorder.



7
8
9
10
11
12
13
14
# File 'lib/animate_it/tracks/recorder.rb', line 7

def initialize(composition, props: {})
  @composition = composition
  @props = composition.props_schema.resolve(props)
  @scene_segments = composition.timeline.segments.each_with_index.filter_map do |segment, index|
    [segment, index] if segment.kind == :scene
  end
  @layers_by_segment = composition.structure_layers.group_by(&:segment_index)
end

Instance Method Details

#callObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/animate_it/tracks/recorder.rb', line 16

def call
  document = Document.new(fps: @composition.fps, duration: @composition.duration_in_frames)
  @composition.structure_layers.each do |layer|
    document.add_layer(layer.key, layer.from_frame, layer.to_frame, origin_frame: layer.segment.from_frame)
  end
  record_animate_dsl(document)
  record_word_reveals(document)
  record_samples(document)
  document
end