Sha256: 090bc7b20a45032b954a3af7b362485653647df6650b61c229701245e7116637
Contents?: true
Size: 992 Bytes
Versions: 3
Compression:
Stored size: 992 Bytes
Contents
require 'ws_light/animation/base_animation' module WSLight module Animation # Slides from one set to another from left to right (obviously depending on the hardware setup) class SlideLeftAnimation < BaseAnimation def frames @set_from.length + 1 # one for each led plus one for all zero end 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 def frames_per_second nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ws_light-0.4.2 | lib/ws_light/animation/slide_left_animation.rb |
ws_light-0.3.0 | lib/ws_light/animation/slide_left_animation.rb |
ws_light-0.2.0 | lib/ws_light/animation/slide_left_animation.rb |