Class: AnimateIt::Beat

Inherits:
Data
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#duration_framesObject (readonly)

Returns the value of attribute duration_frames

Returns:

  • (Object)

    the current value of duration_frames



10
11
12
# File 'lib/animate_it/beats.rb', line 10

def duration_frames
  @duration_frames
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



10
11
12
# File 'lib/animate_it/beats.rb', line 10

def name
  @name
end

#start_frameObject (readonly)

Returns the value of attribute start_frame

Returns:

  • (Object)

    the current value of start_frame



10
11
12
# File 'lib/animate_it/beats.rb', line 10

def start_frame
  @start_frame
end

Instance Method Details

#end_frameObject



11
12
13
# File 'lib/animate_it/beats.rb', line 11

def end_frame
  start_frame + duration_frames
end

#first_halfObject



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

#rangeObject

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_halfObject



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