GTK+ で落書き 17(Ruby)
アニメーションです。ランダムに次々と長方形で塗りつぶしていきます。単純だけれど、なかなかポップだと思うのですが。
自作の RubyGem 'oekaki' を使っています。Ruby コードは以下。
oekaki_sample21.rb
require 'oekaki' Width, Height = 500, 500 Oekaki.app width: Width, height: Height do draw {clear} rectangle = ->{ x1, y1 = rand(Width), rand(Height) x2, y2 = rand(Width), rand(Height) [x1, y1, (x2 - x1).abs, (y2 - y1).abs] } timer(80) do color(rand(0x10000), rand(0x10000), rand(0x10000)) rectangle(true, *rectangle.()) end end