Class: Assimp::Animation
- Inherits:
-
Object
- Object
- Assimp::Animation
- Defined in:
- lib/assimp/animation.rb
Constant Summary collapse
- DEFAULT_TICKS_PER_SECOND =
25.0
Instance Attribute Summary collapse
-
#channels ⇒ Object
readonly
Returns the value of attribute channels.
-
#duration_ticks ⇒ Object
readonly
Returns the value of attribute duration_ticks.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#ticks_per_second ⇒ Object
readonly
Returns the value of attribute ticks_per_second.
Instance Method Summary collapse
- #duration_seconds ⇒ Object
- #effective_ticks_per_second ⇒ Object
-
#initialize(name:, duration_ticks:, ticks_per_second:, channels:) ⇒ Animation
constructor
A new instance of Animation.
Constructor Details
#initialize(name:, duration_ticks:, ticks_per_second:, channels:) ⇒ Animation
Returns a new instance of Animation.
11 12 13 14 15 16 17 |
# File 'lib/assimp/animation.rb', line 11 def initialize(name:, duration_ticks:, ticks_per_second:, channels:) @name = String(name).dup.freeze @duration_ticks = Float(duration_ticks) @ticks_per_second = Float(ticks_per_second) @channels = channels.freeze freeze end |
Instance Attribute Details
#channels ⇒ Object (readonly)
Returns the value of attribute channels.
9 10 11 |
# File 'lib/assimp/animation.rb', line 9 def channels @channels end |
#duration_ticks ⇒ Object (readonly)
Returns the value of attribute duration_ticks.
9 10 11 |
# File 'lib/assimp/animation.rb', line 9 def duration_ticks @duration_ticks end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
9 10 11 |
# File 'lib/assimp/animation.rb', line 9 def name @name end |
#ticks_per_second ⇒ Object (readonly)
Returns the value of attribute ticks_per_second.
9 10 11 |
# File 'lib/assimp/animation.rb', line 9 def ticks_per_second @ticks_per_second end |
Instance Method Details
#duration_seconds ⇒ Object
23 24 25 |
# File 'lib/assimp/animation.rb', line 23 def duration_seconds duration_ticks / effective_ticks_per_second end |
#effective_ticks_per_second ⇒ Object
19 20 21 |
# File 'lib/assimp/animation.rb', line 19 def effective_ticks_per_second ticks_per_second.positive? ? ticks_per_second : DEFAULT_TICKS_PER_SECOND end |