Sha256: f906d302a487e8b3ec0eaecc12dac59d6cf83d0c057b509ca098886ae277d327

Contents?: true

Size: 989 Bytes

Versions: 2

Compression:

Stored size: 989 Bytes

Contents

require 'bundler/setup'
require 'whirled_peas'
require 'whirled_peas/component/list_with_active'

class TemplateFactory
  ITEMS = 400.times.map(&:itself)

  def build(name, args)
    active = args[:active]
    WhirledPeas.template do |composer, settings|
      WhirledPeas.component(composer, settings, :list_with_active) do |component, settings|
        component.items = %w[red orange yellow green blue indigo violet]
        component.separator = ', '
        component.active_index = active
        component.viewport_size = 27
      end
    end
  end
end

class Application
  def start(producer)
    producer.frameset(5, easing: :parametric) do |fs|
      TemplateFactory::ITEMS.length.times { |i| fs.add_frame('intro', args: { active: i }) }
    end
    producer.add_frame('hold', duration: 1, args: { active: TemplateFactory::ITEMS.length - 1 })
  end
end

WhirledPeas.configure do |config|
  config.template_factory = TemplateFactory.new
  config.application = Application.new
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
whirled_peas-0.13.0 examples/components.rb
whirled_peas-0.12.0 examples/components.rb