lib/whirled_peas/animator/producer.rb in whirled_peas-0.11.1 vs lib/whirled_peas/animator/producer.rb in whirled_peas-0.12.0

- old
+ new

@@ -2,34 +2,33 @@ require_relative 'frameset' module WhirledPeas module Animator class Producer - def self.produce(consumer, refresh_rate) - producer = new(consumer, refresh_rate) + def self.produce(consumer) + producer = new(consumer) yield producer consumer.process end - def initialize(consumer, refresh_rate) + def initialize(consumer) @consumer = consumer - @refresh_rate = refresh_rate end - def add_frame(name, duration: nil, args: {}) - frameset(duration || 1 / refresh_rate) do |fs| + def add_frame(name, duration:, args: {}) + frameset(duration) do |fs| fs.add_frame(name, args: args) end end def frameset(duration, easing: :linear, effect: :in_out, &block) - fs = Frameset.new((duration * refresh_rate).round, easing, effect) + fs = Frameset.new(duration, easing, effect) yield fs consumer.add_frameset(fs) end private - attr_reader :consumer, :refresh_rate + attr_reader :consumer end end end