Source

clutter-ocaml / tests / test-viewport.ml


module Stage = ClutterStage
module Texture = ClutterTexture
module Timeline = ClutterTimeline
module Alpha = ClutterAlpha
module Behaviour = ClutterBehaviour
open Clutter
  
let _ =

  let stage_color = Color.rgb (0xcc, 0xcc, 0xcc) in
  let stage = Stage.get_default () in

  stage#set_color stage_color;

  let hand = Texture.create ~filename:"./examples/redhand.png" () in
  hand#set_position 300 200;
  let clip = {left=20; top=21; width=132; height=170} in
  hand#set_clip clip;
  
  hand#set_anchor_point 86 125;
  hand#show;

  stage#add hand;

  let timeline = Timeline.create ~num_frames:200 ~fps:26 () in
  timeline#set_loop true;

  let alpha = Alpha.create ~timeline ~alpha_func:`RAMP_INC in
  let r_behave = Behaviour.Rotate.create ~alpha ~axis:`Z_AXIS
    ~direction:`ROTATE_CW ~angle_start:0. ~angle_end:360. () in
  r_behave#apply hand;

  timeline#start;
  stage#show_all;

  clutter_main ()