Class: Clef::Notation::Slur
- Inherits:
-
Object
- Object
- Clef::Notation::Slur
- Defined in:
- lib/clef/notation/slur.rb
Instance Attribute Summary collapse
-
#end_note ⇒ Object
readonly
Returns the value of attribute end_note.
-
#start_note ⇒ Object
readonly
Returns the value of attribute start_note.
Instance Method Summary collapse
- #control_points(start_point, end_point) ⇒ Array<Array<Float>>
-
#initialize(start_note, end_note) ⇒ Slur
constructor
A new instance of Slur.
Constructor Details
#initialize(start_note, end_note) ⇒ Slur
Returns a new instance of Slur.
10 11 12 13 |
# File 'lib/clef/notation/slur.rb', line 10 def initialize(start_note, end_note) @start_note = start_note @end_note = end_note end |
Instance Attribute Details
#end_note ⇒ Object (readonly)
Returns the value of attribute end_note.
6 7 8 |
# File 'lib/clef/notation/slur.rb', line 6 def end_note @end_note end |
#start_note ⇒ Object (readonly)
Returns the value of attribute start_note.
6 7 8 |
# File 'lib/clef/notation/slur.rb', line 6 def start_note @start_note end |
Instance Method Details
#control_points(start_point, end_point) ⇒ Array<Array<Float>>
18 19 20 21 22 23 24 25 |
# File 'lib/clef/notation/slur.rb', line 18 def control_points(start_point, end_point) midpoint_x = (start_point[0] + end_point[0]) / 2.0 lift = [((end_point[0] - start_point[0]).abs / 4.0), 6.0].max [ [midpoint_x - 8, start_point[1] - lift], [midpoint_x + 8, end_point[1] - lift] ] end |