Class: Rgltf::Animation::Channel
- Inherits:
-
Properties::Base
- Object
- Properties::Base
- Rgltf::Animation::Channel
- Defined in:
- lib/rgltf/properties/animation.rb
Defined Under Namespace
Classes: Target
Constant Summary collapse
- TARGET_PATHS =
%w[translation rotation scale weights].freeze
Instance Attribute Summary collapse
-
#sampler ⇒ Object
readonly
Returns the value of attribute sampler.
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Attributes inherited from Properties::Base
#extensions, #extras, #index, #name, #owner_type, #source_json
Instance Method Summary collapse
-
#initialize(json, document:, animation:, animation_index:, index:) ⇒ Channel
constructor
A new instance of Channel.
- #nested_properties ⇒ Object
- #target_node ⇒ Object
- #target_path ⇒ Object
Methods inherited from Properties::Base
#extension, #parse_extensions!
Constructor Details
#initialize(json, document:, animation:, animation_index:, index:) ⇒ Channel
Returns a new instance of Channel.
27 28 29 30 31 32 33 |
# File 'lib/rgltf/properties/animation.rb', line 27 def initialize(json, document:, animation:, animation_index:, index:) super(json, document:, index:, owner_type: :animation_channel) @sampler = animation.samplers.fetch(json.fetch('sampler')) @target = Target.new(json.fetch('target'), document:, animation_index:, channel_index: index) rescue IndexError, KeyError => e raise FormatError, "invalid animation channel: #{e.}" end |
Instance Attribute Details
#sampler ⇒ Object (readonly)
Returns the value of attribute sampler.
25 26 27 |
# File 'lib/rgltf/properties/animation.rb', line 25 def sampler @sampler end |
#target ⇒ Object (readonly)
Returns the value of attribute target.
25 26 27 |
# File 'lib/rgltf/properties/animation.rb', line 25 def target @target end |
Instance Method Details
#nested_properties ⇒ Object
43 44 45 |
# File 'lib/rgltf/properties/animation.rb', line 43 def nested_properties [target] end |
#target_node ⇒ Object
35 36 37 |
# File 'lib/rgltf/properties/animation.rb', line 35 def target_node target.node end |
#target_path ⇒ Object
39 40 41 |
# File 'lib/rgltf/properties/animation.rb', line 39 def target_path target.path end |