Class: Rgltf::Animation
- Inherits:
-
Properties::Base
- Object
- Properties::Base
- Rgltf::Animation
- Defined in:
- lib/rgltf/properties/animation.rb
Defined Under Namespace
Classes: AnimationSampler, Channel
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#samplers ⇒ Object
readonly
Returns the value of attribute samplers.
Attributes inherited from Properties::Base
#extensions, #extras, #index, #name, #owner_type, #source_json
Instance Method Summary collapse
-
#initialize(json, document:, index:) ⇒ Animation
constructor
A new instance of Animation.
- #nested_properties ⇒ Object
Methods inherited from Properties::Base
#extension, #parse_extensions!
Constructor Details
#initialize(json, document:, index:) ⇒ Animation
Returns a new instance of Animation.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/rgltf/properties/animation.rb', line 7 def initialize(json, document:, index:) super(json, document:, index:, owner_type: :animation) @samplers = json.fetch('samplers').each_with_index.map do |sampler, sampler_index| AnimationSampler.new(sampler, document:, animation_index: index, index: sampler_index) end.freeze @channels = json.fetch('channels').each_with_index.map do |channel, channel_index| Channel.new(channel, document:, animation: self, animation_index: index, index: channel_index) end.freeze rescue KeyError => e raise FormatError, "invalid animation #{index}: #{e.}" end |
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
5 6 7 |
# File 'lib/rgltf/properties/animation.rb', line 5 def channels @channels end |
#samplers ⇒ Object (readonly)
Returns the value of attribute samplers.
5 6 7 |
# File 'lib/rgltf/properties/animation.rb', line 5 def samplers @samplers end |
Instance Method Details
#nested_properties ⇒ Object
19 20 21 |
# File 'lib/rgltf/properties/animation.rb', line 19 def nested_properties [*channels, *samplers] end |