class Castaway::Range

Attributes

end_frame[RW]
start_frame[RW]

Public Class Methods

at_frame(production, frame) click to toggle source
# File lib/castaway/range.rb, line 10
def self.at_frame(production, frame)
  new(production).tap do |range|
    range.start_frame = frame
    range.end_frame = frame
  end
end
at_scene(production, title) click to toggle source
# File lib/castaway/range.rb, line 24
def self.at_scene(production, title)
  new(production).tap do |range|
    range.start_scene = title
    range.end_scene = title
  end
end
at_time(production, time) click to toggle source
# File lib/castaway/range.rb, line 17
def self.at_time(production, time)
  new(production).tap do |range|
    range.start_time = time
    range.end_time = time
  end
end
new(production) click to toggle source
# File lib/castaway/range.rb, line 31
def initialize(production)
  @production = production
  @start_frame = 0
  self.end_time = production.duration
end

Public Instance Methods

end_scene=(title) click to toggle source
# File lib/castaway/range.rb, line 63
def end_scene=(title)
  scene = @production.scene(title)
  raise ArgumentError, "no scene named #{title.inspect}" unless scene
  self.end_time = scene.finish
end
end_time() click to toggle source
# File lib/castaway/range.rb, line 53
def end_time
  @end_frame / @production.fps.to_f
end
end_time=(t) click to toggle source
# File lib/castaway/range.rb, line 49
def end_time=(t)
  @end_frame = (_parse_time(t) * @production.fps).ceil
end
start_scene=(title) click to toggle source
# File lib/castaway/range.rb, line 57
def start_scene=(title)
  scene = @production.scene(title)
  raise ArgumentError, "no scene named #{title.inspect}" unless scene
  self.start_time = scene.start
end
start_time() click to toggle source
# File lib/castaway/range.rb, line 45
def start_time
  @start_frame / @production.fps.to_f
end
start_time=(t) click to toggle source
# File lib/castaway/range.rb, line 41
def start_time=(t)
  @start_frame = (_parse_time(t) * @production.fps).floor
end
truncated?() click to toggle source
# File lib/castaway/range.rb, line 37
def truncated?
  start_frame > 0 || end_time < @production.duration
end