Sha256: 472ca3f917014f225c5c7c53d4509bc4aada5ffbefe9102dcdcfe300a6c9e794
Contents?: true
Size: 1016 Bytes
Versions: 2
Compression:
Stored size: 1016 Bytes
Contents
module Lorraine class Connection def initialize end def write_message(msg) puts "Writing message unimplemented." end def display_pixels(pixel_array) commands = [] pixel_array.each_with_index do |pixel, i| commands << Lorraine::Message.new(:set_pixel, i, pixel[0], pixel[1], pixel[2]) end commands << Lorraine::Message.new(:refresh) commands.each do |command| self.write_message command #self.read_line end end def display_image(img) @current_image = img display_pixels img.rgb_pixels(4095) end def animate_to_image(other_image, duration = 1, fps = 24) frame_time = duration.to_f / fps.to_f frame_count = duration * fps frames = Lorraine::Image.frames_between(@current_image, other_image, frame_count) frames.each do |frame| display_image frame sleep frame_time end end def sever! end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lorraine-0.0.7 | lib/lorraine/connection.rb |
lorraine-0.0.6 | lib/lorraine/connection.rb |