Class: WhirledPeas::Animator::Producer
- Inherits:
-
Object
- Object
- WhirledPeas::Animator::Producer
- Defined in:
- lib/whirled_peas/animator/producer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #add_frame(name, duration:, args: {}) ⇒ Object
- #frameset(duration, easing: :linear, effect: :in_out) {|fs| ... } ⇒ Object
-
#initialize(consumer) ⇒ Producer
constructor
A new instance of Producer.
Constructor Details
#initialize(consumer) ⇒ Producer
Returns a new instance of Producer.
13 14 15 |
# File 'lib/whirled_peas/animator/producer.rb', line 13 def initialize(consumer) @consumer = consumer end |
Class Method Details
.produce(consumer) {|producer| ... } ⇒ Object
7 8 9 10 11 |
# File 'lib/whirled_peas/animator/producer.rb', line 7 def self.produce(consumer) producer = new(consumer) yield producer consumer.process end |
Instance Method Details
#add_frame(name, duration:, args: {}) ⇒ Object
17 18 19 20 21 |
# File 'lib/whirled_peas/animator/producer.rb', line 17 def add_frame(name, duration:, args: {}) frameset(duration) do |fs| fs.add_frame(name, args: args) end end |
#frameset(duration, easing: :linear, effect: :in_out) {|fs| ... } ⇒ Object
23 24 25 26 27 |
# File 'lib/whirled_peas/animator/producer.rb', line 23 def frameset(duration, easing: :linear, effect: :in_out, &block) fs = Frameset.new(duration, easing, effect) yield fs consumer.add_frameset(fs) end |