Class: Rgltf::Animation::AnimationSampler
- Inherits:
-
Properties::Base
- Object
- Properties::Base
- Rgltf::Animation::AnimationSampler
- Defined in:
- lib/rgltf/properties/animation.rb
Constant Summary collapse
- INTERPOLATIONS =
{ 'LINEAR' => :linear, 'STEP' => :step, 'CUBICSPLINE' => :cubicspline }.freeze
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#interpolation ⇒ Object
readonly
Returns the value of attribute interpolation.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Attributes inherited from Properties::Base
#extensions, #extras, #index, #name, #owner_type, #source_json
Instance Method Summary collapse
- #duration ⇒ Object
-
#initialize(json, document:, animation_index:, index:) ⇒ AnimationSampler
constructor
A new instance of AnimationSampler.
Methods inherited from Properties::Base
#extension, #nested_properties, #parse_extensions!
Constructor Details
#initialize(json, document:, animation_index:, index:) ⇒ AnimationSampler
Returns a new instance of AnimationSampler.
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/rgltf/properties/animation.rb', line 80 def initialize(json, document:, animation_index:, index:) super(json, document:, index:, owner_type: :animation_sampler) @input = document.fetch_reference(:accessors, json.fetch('input'), "animations/#{animation_index}/samplers/#{index}/input") @output = document.fetch_reference(:accessors, json.fetch('output'), "animations/#{animation_index}/samplers/#{index}/output") @interpolation = INTERPOLATIONS.fetch(json.fetch('interpolation', 'LINEAR')) rescue KeyError => e raise FormatError, "invalid animation sampler: #{e.}" end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
78 79 80 |
# File 'lib/rgltf/properties/animation.rb', line 78 def input @input end |
#interpolation ⇒ Object (readonly)
Returns the value of attribute interpolation.
78 79 80 |
# File 'lib/rgltf/properties/animation.rb', line 78 def interpolation @interpolation end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
78 79 80 |
# File 'lib/rgltf/properties/animation.rb', line 78 def output @output end |
Instance Method Details
#duration ⇒ Object
91 92 93 |
# File 'lib/rgltf/properties/animation.rb', line 91 def duration input.max&.first || 0.0 end |