Class: FlameChannelParser::Segments::ConstantSegment

Inherits:
Object
  • Object
show all
Defined in:
lib/segments.rb

Overview

This segment just stays on the value of it’s keyframe

Direct Known Subclasses

ConstantFunction, LinearSegment

Constant Summary collapse

NEG_INF =

:nodoc:

(-1.0/0.0)
POS_INF =
(1.0/0.0)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(from_frame, to_frame, value) ⇒ ConstantSegment

Returns a new instance of ConstantSegment.



23
24
25
26
27
# File 'lib/segments.rb', line 23

def initialize(from_frame, to_frame, value)
  @start_frame = from_frame
  @end_frame = to_frame
  @v1 = value
end

Instance Attribute Details

#end_frameObject (readonly)

Returns the value of attribute end_frame.



11
12
13
# File 'lib/segments.rb', line 11

def end_frame
  @end_frame
end

#start_frameObject (readonly)

Returns the value of attribute start_frame.



11
12
13
# File 'lib/segments.rb', line 11

def start_frame
  @start_frame
end

Instance Method Details

#defines?(frame) ⇒ Boolean

Tells whether this segment defines the value of the function at this time T

Returns:

  • (Boolean)


14
15
16
# File 'lib/segments.rb', line 14

def defines?(frame)
  (frame < end_frame) && (frame >= start_frame)
end

#value_at(frame) ⇒ Object

Returns the value at this time T



19
20
21
# File 'lib/segments.rb', line 19

def value_at(frame)
  @v1
end