October 2009

Hi-res Ruby On Acid wallpapers…

Went back and re-rendered some of my favorites at 1080p resolution (should scale down to widescreen monitors nicely).
007910006901237

development
ruby

Permalink

Ruby on Acid: YAML says it all…

00021_random.png

--- !ruby/object:RubyOnAcid::MetaFactory
assigned_factories:
  :x2: &id001 !ruby/object:RubyOnAcid::LoopFactory
    counters:
      :x2: 0.0809003150016822
      :x: 0.0809003150016822
    interval: 0.0431080448196972
  :y: &id005 !ruby/object:RubyOnAcid::SineFactory
    counters:
      :y: -47.6973132292325
    interval: -0.0661543872804878
  :blue: &id004 !ruby/object:RubyOnAcid::SineFactory
    counters:
      :blue: -49.6672530194527
    interval: -0.0688866199992418
  :y2: &id006 !ruby/object:RubyOnAcid::SineFactory
    counters:
      :y2: -48.3512112649079
    interval: -0.067061319368805
  :alpha: &id002 !ruby/object:RubyOnAcid::LoopFactory
    counters:
      :alpha: 0.026577401239561
    interval: 0.0735458771168371
  :width: &id008 !ruby/object:RubyOnAcid::RepeatFactory
    repeat_count: 73.7486871161379
    repeat_counts:
      :width: 55
    source_factory: !ruby/object:RubyOnAcid::SineFactory
      counters:
        :width: -0.763070310680217
      interval: -0.0763070310680217
    values:
      :width: 0.154428166901605
  :red: &id003 !ruby/object:RubyOnAcid::FlashFactory
    counters:
      :red: 35
    interval: 48.2819400095083
    values:
      :red: 1.0
  :x: *id001
  :green: &id007 !ruby/object:RubyOnAcid::RepeatFactory
    repeat_count: 92.57504008154
    repeat_counts:
      :green: 70
    source_factory: !ruby/object:RubyOnAcid::LoopFactory
      counters:
        :green: 0.389712742634083
      interval: -0.0762859071707396
    values:
      :green: 0.389712742634083
factory_pool:
- !ruby/object:RubyOnAcid::LoopFactory
  counters: {}

  interval: 0.00689322163990813
- *id002
- !ruby/object:RubyOnAcid::LoopFactory
  counters: {}

  interval: -0.0330245624043419
- *id001
- !ruby/object:RubyOnAcid::ConstantFactory
  value: 0.799727962512452
- *id003
- *id004
- *id005
- !ruby/object:RubyOnAcid::SineFactory
  counters: {}

  interval: -0.04853454869413
- *id006
- *id007
- !ruby/object:RubyOnAcid::RepeatFactory
  repeat_count: 385.71501513496
  repeat_counts: {}

  source_factory: !ruby/object:RubyOnAcid::RandomFactory {}

  values: {}

- *id008
- !ruby/object:RubyOnAcid::ModuloFactory
  prior_values: {}

  source_factory: !ruby/object:RubyOnAcid::LoopFactory
    counters: {}

    interval: 1.0e-05

development
ruby

Permalink

Ruby on Acid: ConstantGenerator…

It seems obvious, in retrospect, that a little stability was needed with all this randomness…

@f.factory_pool << RubyOnAcid::ConstantFactory.new(rand)

In the image below, one of the Y coordinates is hooked up to a ConstantGenerator whose get_unit() always returns 0.5, hence, always halfway down the screen.

picture-1.png

Similarly:

picture-6.pngpicture-9.pngpicture-8.png

development
ruby

Permalink

This is an XSD example from a normally stodgy tutorial site; were they trying for innuendo?

<xs:complexType name="jeans">
  <xs:simpleContent>
    <xs:extension base="size">
      <xs:attribute name="sex">

development

Permalink

Ruby on Acid, continued…

Came up with an elaborate setup to step through all the permutations of an array of generators, and was getting so much repetition that I switched back to picking randomly. :P Dropped the increment and skip generators from the pool for this run because, frankly, they tended to make things ugly. I have a couple plans to “mute” or otherwise influence their effects, though, so I may be using them further in the future.

A YAML dump of the generators is embedded in each picture, so if you squint you can read what went into each.

00006_random.jpg00046_random.jpg00064_random.jpg00069_random.jpg00113_random.jpg00121_random.jpg00147_random.jpg00170_random.jpg00180_random.jpg

development
ruby

Permalink

MetaGenerator…

I’m getting an insane amount of variety out of very little code.

picture-39.pngpicture-38.pngpicture-37.png
picture-36.pngpicture-34.png

require 'rubygems'
require 'wx'
require 'rubyonacid/factories/meta'
require 'rubyonacid/factories/flash'
require 'rubyonacid/factories/increment'
require 'rubyonacid/factories/loop'
require 'rubyonacid/factories/random'
require 'rubyonacid/factories/sine'
require 'rubyonacid/factories/skip'

class MyApp < Wx::App

  WIDTH = 480
  HEIGHT = 480

  def on_init

    @f = RubyOnAcid::MetaFactory.new
    @f.factories << RubyOnAcid::FlashFactory.new
    @f.factories << RubyOnAcid::LoopFactory.new
    @f.factories << RubyOnAcid::RandomFactory.new
    @f.factories << RubyOnAcid::SineFactory.new
    @f.factories << RubyOnAcid::SkipFactory.new

    @resetter = RubyOnAcid::SkipFactory.new(0.999)

    #Containing frame.
    frame = Wx::Frame.new(nil, :size => [WIDTH, HEIGHT])
    frame.show

    #Displays drawing.
    window = Wx::Window.new(frame, :size => [WIDTH, HEIGHT])

    #Animate periodically.
    t = Wx::Timer.new(self, 55)
    evt_timer(55) {animate(window)}
    t.start(33)

  end

  def animate(window)
     window.paint do |surface|
       surface.pen = Wx::Pen.new(
           Wx::Colour.new(
             @f.within(:red, 0, 255).to_i,
             @f.within(:green, 0, 255).to_i,
             @f.within(:blue, 0, 255).to_i,
             @f.within(:alpha, 50, 255).to_i
           ),
           @f.within(:width, 1, 5).to_i
       )
       surface.draw_line(
          @f.within(:x, 0, WIDTH).to_i,
          @f.within(:y, 0, HEIGHT).to_i,
          @f.within(:x2, 0, WIDTH).to_i,
          @f.within(:y2, 0, HEIGHT).to_i
       )
     end
     @f.reset_assignments if @resetter.boolean(:reset)
  end

end

app = MyApp.new
app.main_loop

development
ruby

Permalink