Class: FlameChannelParser::Segments::LinearExtrapolate

Inherits:
ConstantExtrapolate show all
Defined in:
lib/segments.rb

Overview

This segment does extrapolation using the tangent from the preceding keyframe

Constant Summary

Constants inherited from ConstantSegment

ConstantSegment::NEG_INF, ConstantSegment::POS_INF

Instance Attribute Summary

Attributes inherited from ConstantSegment

#end_frame, #start_frame

Instance Method Summary collapse

Methods inherited from ConstantSegment

#defines?

Constructor Details

#initialize(from_frame, base_value, tangent) ⇒ LinearExtrapolate

:nodoc:



228
229
230
231
# File 'lib/segments.rb', line 228

def initialize(from_frame, base_value, tangent)
  super(from_frame, base_value)
  @tangent = tangent.to_f
end

Instance Method Details

#value_at(frame) ⇒ Object



233
234
235
236
# File 'lib/segments.rb', line 233

def value_at(frame)
  frame_diff = (frame - @start_frame)
  @base_value + (@tangent * frame_diff)
end