Class: Tracksperanto::Tracker
- Inherits:
-
Array
- Object
- Array
- Tracksperanto::Tracker
- Includes:
- Comparable, Casts
- Defined in:
- lib/tracksperanto/tracker.rb
Overview
Internal representation of a tracker point with keyframes. A Tracker is an array of Keyframe objects and should act and work like one
Instance Attribute Summary collapse
-
#name ⇒ Object
Contains the name of the tracker.
Instance Method Summary collapse
-
#<=>(other_tracker) ⇒ Object
Trackers sort by the position of the first keyframe.
-
#initialize(object_attribute_hash = {}) {|_self| ... } ⇒ Tracker
constructor
A new instance of Tracker.
- #inspect ⇒ Object
-
#keyframe!(options) ⇒ Object
Create and save a keyframe in this tracker.
- #keyframes ⇒ Object
- #keyframes=(new_kf_array) ⇒ Object
Methods included from Casts
#cast_to_float, #cast_to_int, #cast_to_string, included
Constructor Details
#initialize(object_attribute_hash = {}) {|_self| ... } ⇒ Tracker
Returns a new instance of Tracker.
10 11 12 13 14 15 |
# File 'lib/tracksperanto/tracker.rb', line 10 def initialize(object_attribute_hash = {}) @name = "Tracker" __setobj__(Array.new) object_attribute_hash.map { |(k, v)| send("#{k}=", v) } yield(self) if block_given? end |
Instance Attribute Details
#name ⇒ Object
Contains the name of the tracker
7 8 9 |
# File 'lib/tracksperanto/tracker.rb', line 7 def name @name end |
Instance Method Details
#<=>(other_tracker) ⇒ Object
Trackers sort by the position of the first keyframe
26 27 28 |
# File 'lib/tracksperanto/tracker.rb', line 26 def <=>(other_tracker) self[0].frame <=> other_tracker[0].frame end |
#inspect ⇒ Object
35 36 37 |
# File 'lib/tracksperanto/tracker.rb', line 35 def inspect "<T #{name.inspect} with #{length} keyframes>" end |
#keyframe!(options) ⇒ Object
Create and save a keyframe in this tracker
31 32 33 |
# File 'lib/tracksperanto/tracker.rb', line 31 def keyframe!() push(Tracksperanto::Keyframe.new()) end |
#keyframes ⇒ Object
21 22 23 |
# File 'lib/tracksperanto/tracker.rb', line 21 def keyframes __getobj__ end |
#keyframes=(new_kf_array) ⇒ Object
17 18 19 |
# File 'lib/tracksperanto/tracker.rb', line 17 def keyframes=(new_kf_array) __setobj__(new_kf_array.dup) end |