'."\n"; ?> ming/blink.ml

let () =
  let mlen = 144.0 in  (* Size of movie *)
  let slen = mlen *. 2.0 /. 3.0 in  (* Size of sprite *)

  SWF.Ming.set_scale ~scale:20.0;

  (* Draw the shape *)
  let shape = SWF.Shape.new_shape() in
  let fill = SWF.Shape.add_solid_fill ~shape
                ~red:0x00 ~green:0xff ~blue:0x80 ~alpha:0xff in
  SWF.Shape.set_right_fill ~shape ~fill;
  SWF.Shape.move_pen_to ~shape ~x:(-.slen /. 2.0)  ~y:(-.slen /. 2.0);
  SWF.Shape.draw_line ~shape ~dx:slen     ~dy:0.0;
  SWF.Shape.draw_line ~shape ~dx:0.0      ~dy:slen;
  SWF.Shape.draw_line ~shape ~dx:(-.slen) ~dy:0.0;
  SWF.Shape.draw_line ~shape ~dx:0.0      ~dy:(-.slen);

  (* Create the sprite *)
  let movie_clip = SWF.MovieClip.new_movie_clip() in
  let display_item = SWF.MovieClip.add ~movie_clip ~block:(SWF.block_of_shape ~shape) in

  for j=0 to pred 24 do
     SWF.DisplayItem.set_color_mult ~display_item ~red:1.0 ~green:1.0 ~blue:1.0 ~alpha:(float j /. 24.0);
     SWF.DisplayItem.rotate_to ~display_item ~degrees:(-.360.0/.4./.24.*.(float)j);
     SWF.MovieClip.next_frame ~movie_clip;
  done;
  for j=0 to pred 24 do
     SWF.DisplayItem.set_color_mult ~display_item ~red:1.0 ~green:1.0 ~blue:1.0 ~alpha:(float(24-j)/.24.0);
     SWF.DisplayItem.rotate_to ~display_item ~degrees:(-.360.0/.4./.24.*.(float)j);
     SWF.MovieClip.next_frame ~movie_clip;
  done;

  (* Make the movie *)
  let movie = SWF.Movie.new_movie() in
  let display_item = SWF.Movie.add ~movie ~block:(SWF.block_of_movie_clip ~movie_clip) in
  SWF.DisplayItem.move_to ~display_item ~x:(mlen/.2.0)  ~y:(mlen/.2.0);
  SWF.Movie.set_background ~movie ~red:0xff ~green:0xff ~blue:0xff;
  SWF.Movie.set_dimension ~movie  ~x:mlen  ~y:mlen;

  (* Save the movie *)
  let filename = "blink_ml.swf" in
  let st = SWF.Movie.save ~movie ~filename in
  Printf.printf " size of file '%s' = %d octets\n%!" filename st;
;;