Class: AnimateIt::Beat
- Inherits:
-
Data
- Object
- Data
- AnimateIt::Beat
- Defined in:
- lib/animate_it/beats.rb
Overview
A named time marker on a Composition's timeline. Beats let you give frame ranges meaningful names ("intro", "voice_note", "thinking") and reference them from animations:
beat :voice_note, at: "5.5s", length: "0.67s"
animate :step_2 do
fade in: :voice_note
end
Instance Attribute Summary collapse
-
#duration_frames ⇒ Object
readonly
Returns the value of attribute duration_frames.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#start_frame ⇒ Object
readonly
Returns the value of attribute start_frame.
Instance Method Summary collapse
- #end_frame ⇒ Object
- #first_half ⇒ Object
-
#range ⇒ Object
Inclusive:
range.lastis the last frame the beat covers. - #second_half ⇒ Object
Instance Attribute Details
#duration_frames ⇒ Object (readonly)
Returns the value of attribute duration_frames
10 11 12 |
# File 'lib/animate_it/beats.rb', line 10 def duration_frames @duration_frames end |
#name ⇒ Object (readonly)
Returns the value of attribute name
10 11 12 |
# File 'lib/animate_it/beats.rb', line 10 def name @name end |
#start_frame ⇒ Object (readonly)
Returns the value of attribute start_frame
10 11 12 |
# File 'lib/animate_it/beats.rb', line 10 def start_frame @start_frame end |
Instance Method Details
#end_frame ⇒ Object
11 12 13 |
# File 'lib/animate_it/beats.rb', line 11 def end_frame start_frame + duration_frames end |
#first_half ⇒ Object
20 21 22 23 |
# File 'lib/animate_it/beats.rb', line 20 def first_half half = duration_frames / 2 start_frame..(start_frame + half) end |
#range ⇒ Object
Inclusive: range.last is the last frame the beat covers.
16 17 18 |
# File 'lib/animate_it/beats.rb', line 16 def range start_frame..end_frame end |
#second_half ⇒ Object
25 26 27 28 |
# File 'lib/animate_it/beats.rb', line 25 def second_half half = duration_frames / 2 (start_frame + half)..end_frame end |