Sha256: 916aee51bcdae978d3ea933f68311cf42a51d62cd27de1e0e9d7bfa4a9876a23

Contents?: true

Size: 635 Bytes

Versions: 1

Compression:

Stored size: 635 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 FadeAnimation < BaseAnimation
      FADE_DURATION = 50

      def frames
        FADE_DURATION + 1
      end

      def frame(count)
        set = []

        @set_from.next_frame
        @set_to.next_frame

        @set_from.full_length.times do |i|
          set << @set_from.pixel(i).mix(@set_to.pixel(i), count.to_f / FADE_DURATION.to_f)
        end

        set
      end

      def frames_per_second
        nil
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ws_light-0.4.2 lib/ws_light/animation/fade_animation.rb