Class: Chaussettes::Effect::Fade

Inherits:
Object
  • Object
show all
Defined in:
lib/chaussettes/effect/fade.rb

Overview

Represents a fade effect

Constant Summary collapse

TYPE_MAP =
{
  nil => nil,
  :h => 'h', 'h' => 'h', :half_sine => 'h',
  :l => 'l', 'l' => 'l', :log => 'l', :logarithmic => 'l',
  :p => 'p', 'p' => 'p', :parabola => 'p', :inverted_parabola => 'p',
  :q => 'q', 'q' => 'q', :quarter => 'q',
  :t => 't', 't' => 't', :linear => 't', :triangle => 't'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(in_len, stop_at = nil, out_len = nil, type: nil) ⇒ Fade

Returns a new instance of Fade.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/chaussettes/effect/fade.rb', line 17

def initialize(in_len, stop_at = nil, out_len = nil, type: nil)
  real_type = TYPE_MAP.fetch(type)

  @commands = [ 'fade' ]
  @commands << real_type if real_type
  @commands << in_len
  @commands << stop_at if stop_at
  @commands << out_len if stop_at && out_len

  @commands.freeze
end

Instance Attribute Details

#commandsObject (readonly)

Returns the value of attribute commands.



15
16
17
# File 'lib/chaussettes/effect/fade.rb', line 15

def commands
  @commands
end