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