Hey, I just hacked together a solution. The problem was that it was taking too
long to draw, and the angle of spin was quite large. So it looked like it was
going anti-clockwise, when in fact it went clockwise, but far. Shoes itself is
also slow now. Anyways, this code works:
Speed = 0.1
Shoes.app :width => 600, :height => 600, :resizable => false do
transform(:center)
para "Rotate Angle:"
ang = para "0"
def taiji
image 280, 280, :top => 100, :left => 150 do
# drawing order is important!!!
stroke black
nofill
oval 0, 0, :radius =>140
#angle1 -> angle2 is clockwise, lead to fill surplus semi-circle
fill black
shape do
move_to 70, 50
arc_to 140,70,140,140,TWO_PI-PI/2,PI/2
arc_to 140,210,140,140,PI/2,TWO_PI-PI/2
arc_to 140,140,280,280,PI/2,TWO_PI-PI/2
end
stroke white
fill white
oval 70,140,:radius=>70 # erase the surplus black semi-circle
oval 120, 50, :radius =>20
fill black
oval 120, 190, :radius =>20
end
end
animate(20) do |i|
clear
#clear backgroud
stroke black
fill white
oval 150, 100, :radius =>140
spin = i*Speed
ang.replace "#{spin}"
rotate spin #30 * cnt
taiji
end
end
CC: [email protected]
Subject: I want to draw a taiji animation by shoes
From: [email protected]
To: [email protected]
Date: Thu, 6 Aug 2009 22:15:31 +0800
hi,
I'm from China.I want to produce a rotate taiji animation by shoes.But I found
2 problems.
1st,there is no fill() method(filled an enclose area with specified color) in
shoes.So I have
to first draw black area,then draw a white semi-circle to erase part of black
area to produce
Taiji map.Maybe someone has better method.
2nd,to make rotate animation,I draw a taiji map then rotate a certain angle in
each step.The
angle increased relate to time.Without animate,the taiji map was displalyed in
correct
rotated angle.But when I add animate method,the taiji does not rotate as I
expected.Sometimes
it rotate clockwise,sometimes it rotate anti-clockwise.I don't know why.
ruby code in attachment.
Jason Zhou
_________________________________________________________________
Get free photo software from Windows Live
http://www.windowslive.com/online/photos?ocid=PID23393::T:WLMTAGL:ON:WL:en-US:SI_PH_software:082009