#!/usr/bin/env ruby
#
# gradient.rb -- IKEGAMI Daisuke
# original is http://ming.sourceforge.net/examples/example.php?name=gradient
# $Log: gradient.rb,v $
# Revision 1.1  2004/11/07 17:34:22  ikegami
# NEWS: version 0.1.7 shipped.
# some bugs are fixed, and it seems work with Ming 0.3beta1.
#

require 'ming/ming'
include Ming

set_scale(20.0)
m = SWFMovie.new
m.set_dimension(320, 240)

s = SWFShape.new

# first gradient- black to white

g = SWFGradient.new
g.add_entry(0.0, 0, 0, 0)
g.add_entry(1.0, 0xff, 0xff, 0xff)

f = s.add_gradient_fill(g, SWFFill::LINEAR_GRADIENT)
f.scale_to(0.17)
f.move_to(160, 120)
s.set_right_fill(f)
s.draw_line(320, 0)
s.draw_line(0, 240)
s.draw_line(-320, 0)
s.draw_line(0, -240)

m.add(s)

s = SWFShape.new

# second gradient- radial gradient from white to red to transparent
g = SWFGradient.new
g.add_entry(0.0, 0xff, 0, 0, 0xff)
g.add_entry(1.0, 0xff, 0, 0, 0)

f = s.add_fill(g, SWFFill::RADIAL_GRADIENT)
f.scale_to(0.12)
f.move_to(160, 120)
s.set_right_fill(f)
s.draw_line(320, 0)
s.draw_line(0, 240)
s.draw_line(-320, 0)
s.draw_line(0, -240)

m.add(s)

m.save('gradient.swf')
