class WSLight::Animation::SlideLeftAnimation

Slides from one set to another from left to right (obviously depending on the hardware setup)

Public Instance Methods

frame(count) click to toggle source
# File lib/ws_light/animation/slide_left_animation.rb, line 11
def frame(count)
  set = []
  reverse_set = []

  @set_from.next_frame
  @set_to.next_frame

  (set_from.length - count).times do |i|
    set << set_from.pixel(i)
    reverse_set << set_from.pixel((set_from.length * 2) - 1 - i) if set_from.type == :double
  end

  count.times do |i|
    set << set_to.pixel(set_from.length - count + i)
    reverse_set << set_to.pixel(set_from.length + count - 1 - i) if set_from.type == :double
  end

  set += reverse_set.reverse if set_from.type == :double

  set
end
frames() click to toggle source
# File lib/ws_light/animation/slide_left_animation.rb, line 7
def frames
  @set_from.length + 1 # one for each led plus one for all zero
end
frames_per_second() click to toggle source
# File lib/ws_light/animation/slide_left_animation.rb, line 33
def frames_per_second
  nil
end