Codeswarm rewrite in ruby
Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 2 commits ahead, 6 commits behind felipec:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
util
README
app.rb
config.rb
events.rb
model.rb
scene.rb
vector.rb

README

codeswarm.rb is a rewrite of Michael Ogawa's code_swarm in ruby using cairo.

For the original code:
http://code.google.com/p/codeswarm

The format of the events xml file is compatible with code_swarm's one.

You'll need libxml-ruby and cairo ruby files. You can use gem to install the dependencies:
 sudo gem install libxml-ruby
 sudo gem install cairo

== howto generate a video ==

This describes how to generate an H.264 video clip using mencoder, but it's
also possible to export singe png images.

First create a fifo file:
 mkfifo /tmp/codeswarm_rgb.bin

Then on a console launch mencoder:
 mencoder -demuxer rawvideo -rawvideo w=640:h=480:fps=72:format=bgr32 \
 -ovc x264 -x264encopts crf=10 -oac copy -o /tmp/movie.avi \
 /tmp/codeswarm_rgb.bin

It will wait until there's data on the fifo file.

Then launch codeswarm.rb:
 ruby app.rb

If you want to include audio add this:
 -audioclip foobar.mp3

Alternatively, you can generate a video by merging the images into a vido:
 ffmpeg -f image2 -r 24 -i ./frames/%05d.png -acodec copy -sameq ./linux.avi -pass 2

That's it!