Class: WhirledPeas::Animator::Producer

Inherits:
Object
  • Object
show all
Defined in:
lib/whirled_peas/animator/producer.rb

Class Method Summary collapse

Instance Method Summary collapse

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

Yields:

  • (producer)


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

Yields:

  • (fs)


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