はてなでFlashプログラミング その2

Ming/Rubyいじりから拝借。


実行

response.content_type = 'application/x-shockwave-flash'

--Ming.set_scale(1.0)

m = SWFMovie.new()
m.set_dimension(600, 600)

s = SWFShape.new()
f = s.add_fill(0x00, 0xff, 0x80, 0x80)
s.set_right_fill(f)
s.move_pen_to(-200, -200)
s.draw_line(400, 0)
s.draw_line(0, 400)
s.draw_line(-400, 0)
s.draw_line(0, -400)

i = m.add(s)
i.move_to(300, 300)

for j = 1, 24 do
  i.mult_color(1.0, 1.0, 1.0, j / 24.0)
  i.rotate_to(-360.0 / 4 / 24 * j)
  m.next_frame()
end

for j = 1, 24 do
  i.mult_color(1.0, 1.0, 1.0, (24 - j) / 24.0)
  i.rotate_to(-360.0 / 4 / 24 * j)
  m.next_frame()
end

response.output_movie(m)

デバッグしづらい…orz
Ming.set_scale(1.0)すると、全体的に影響が出るし。