2008/09/17

Shoes new methods arc and cap

_why showed us a few tips about new methods on the Shoes ML. Wonderful combination of the method animate!

Do run the below code, will start drawing the colorful circle! B-)

# arcs.rb
Shoes.app :width => 200, :height => 100, :title => 'Arcs' do
fill green.to_s..yellow.to_s, :angle => 45
stroke red.to_s..blue.to_s, :angle => 90
strokewidth 10
cap :round

a = animate 12 do |i|
@c.remove if @c
r = i * (PI * 0.01)
@c = arc 100, 50, 180, 60, 0, i * (PI * 0.01)
a.remove if r >= TWO_PI
end
end


# started


# almost finish


ashbb

O'Reilly Ruby Books

Twitter Updates

    follow me on Twitter