Class: Castaway::Element::Pointer
- Defined in:
- lib/castaway/element/pointer.rb
Instance Attribute Summary
Attributes inherited from Still
Attributes inherited from Base
#attributes, #production, #scene, #size
Instance Method Summary collapse
- #hotspot ⇒ Object
-
#initialize(production, scene, id) ⇒ Pointer
constructor
A new instance of Pointer.
- #position ⇒ Object
Methods inherited from Still
Methods inherited from Base
#_absolute, #_composite, #_convert, #_evaluate_animation_list, #_evaluate_attributes!, #_transform, #alive_at?, #animate, #at, #attribute, #duration, #effect, #enter, #exit, #gravity, #in, #out, #path, #render_at, #rotate, #scale, #t1, #t2, #tail
Constructor Details
#initialize(production, scene, id) ⇒ Pointer
Returns a new instance of Pointer.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/castaway/element/pointer.rb', line 9 def initialize(production, scene, id) path, = production.pointers.fetch(id) super(production, scene, path) @box = Box.from_size(@size) @box[:hotspot] = Castaway::Point.make([:hotspot] || [0, 0]) ideal_width = production.resolution.width * [:scale] sx = ideal_width.to_f / @size.width scale(sx) end |
Instance Method Details
#hotspot ⇒ Object
22 23 24 25 26 27 |
# File 'lib/castaway/element/pointer.rb', line 22 def hotspot @box. scale(@scale || 0). rotate(@angle || 0). bounds[:hotspot] end |
#position ⇒ Object
29 30 31 |
# File 'lib/castaway/element/pointer.rb', line 29 def position @position - hotspot end |