resources/RooUsage.txt
[app.Builder.js] / tests / clutter.js
1 GtkClutter = imports.gi.GtkClutter;
2 Clutter = imports.gi.Clutter;
3 Gtk  = imports.gi.Gtk;
4
5 Gtk.init(null,null);
6 GtkClutter.init(null,null);
7
8  
9     /* construct the toplevel UI */
10 //win = new Gtk.Window.c_new(Gtk.WindowType.TOPLEVEL);
11
12
13 clutter  = new GtkClutter.Window({ 
14         type:Gtk.WindowType.TOPLEVEL, 
15         default_width : 500,
16         default_height : 500
17  } );
18  print(clutter);
19 //win.add(clutter); 
20
21 clutter.signal.show.connect(function() {
22         print ("SHOW");
23         stage = clutter.get_stage();
24         button = new Gtk.Button({ label: 'test'} );
25         button.show();
26         actor = new GtkClutter.Actor.with_contents(button);
27         actor.fixed_x = 100;
28         actor.fixed_y = 100;
29         stage.add_actor(actor);
30          actor.set_receives_events(true);
31         button.signal.enter.connect(function() {
32                 print("ENTER EVENT");
33
34                 animate = actor.animate(
35                         Clutter.AnimationMode.EASE_OUT_ELASTIC, 2000,
36                         {
37                                    scale_x : 5,
38                                   scale_y: 5,
39
40                         }
41                 );
42                 animate.timeline.start();
43         });
44         button.signal.leave.connect(function() {
45                 print("LEAVE EVENT");
46
47                 animate = actor.animate(
48                         Clutter.AnimationMode.EASE_OUT_ELASTIC, 2000,
49                         {
50                                    scale_x : 1,
51                                   scale_y: 1,
52
53                         }
54                 );
55                 animate.timeline.start();
56         });
57 /*
58         animation = actor.animatev(
59                 Clutter.AnimationMode.EASE_IN_OUT_SINE, 5000,
60                 5,
61                  [ "fixed::x", // (float) allocation.x,
62                     "fixed::y", //(float) allocation.y,
63 //                 "fixed::scale-gravity", //CLUTTER_GRAVITY_CENTER,
64                     "scale-x",// 0.,
65                     "scale-y",// 0.,
66                     "opacity", //0x0,
67                 ],
68                 [   100,
69                      100,
70                     0.0,
71                       0.0,
72                      0,
73                 ]
74         );
75 */
76  });
77
78 clutter.show_all();
79
80 Gtk.main(); 
81
82
83