Class: FlameChannelParser::Segments::LinearSegment
- Inherits:
-
ConstantSegment
- Object
- ConstantSegment
- FlameChannelParser::Segments::LinearSegment
- Defined in:
- lib/segments.rb
Overview
This segment linearly interpolates
Direct Known Subclasses
BezierSegment, ConstantExtrapolate, ConstantPrepolate, HermiteSegment, LinearPrepolate
Constant Summary
Constants inherited from ConstantSegment
ConstantSegment::NEG_INF, ConstantSegment::POS_INF
Instance Attribute Summary
Attributes inherited from ConstantSegment
Instance Method Summary collapse
-
#initialize(from_frame, to_frame, value1, value2) ⇒ LinearSegment
constructor
:nodoc:.
-
#value_at(frame) ⇒ Object
Returns the value at this time T.
Methods inherited from ConstantSegment
Constructor Details
#initialize(from_frame, to_frame, value1, value2) ⇒ LinearSegment
:nodoc:
33 34 35 36 |
# File 'lib/segments.rb', line 33 def initialize(from_frame, to_frame, value1, value2) @vint = (value2 - value1) super(from_frame, to_frame, value1) end |
Instance Method Details
#value_at(frame) ⇒ Object
Returns the value at this time T
39 40 41 42 |
# File 'lib/segments.rb', line 39 def value_at(frame) on_t_interval = (frame - @start_frame).to_f / (@end_frame - @start_frame) @v1 + (on_t_interval * @vint) end |