Class: Rgltf::Animation::Channel

Inherits:
Properties::Base show all
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

Attributes inherited from Properties::Base

#extensions, #extras, #index, #name, #owner_type, #source_json

Instance Method Summary collapse

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.message}"
end

Instance Attribute Details

#samplerObject (readonly)

Returns the value of attribute sampler.



25
26
27
# File 'lib/rgltf/properties/animation.rb', line 25

def sampler
  @sampler
end

#targetObject (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_propertiesObject



43
44
45
# File 'lib/rgltf/properties/animation.rb', line 43

def nested_properties
  [target]
end

#target_nodeObject



35
36
37
# File 'lib/rgltf/properties/animation.rb', line 35

def target_node
  target.node
end

#target_pathObject



39
40
41
# File 'lib/rgltf/properties/animation.rb', line 39

def target_path
  target.path
end