seed r756 - trunk/examples



Author: hortont
Date: Sun Jan 18 00:57:13 2009
New Revision: 756
URL: http://svn.gnome.org/viewvc/seed?rev=756&view=rev

Log:
Some small style updates for examples, nothing huge.



Modified:
   trunk/examples/accelgroup.js
   trunk/examples/actions.js
   trunk/examples/clutter-cairo.js
   trunk/examples/clutter-cogl.js
   trunk/examples/clutter.js

Modified: trunk/examples/accelgroup.js
==============================================================================
--- trunk/examples/accelgroup.js	(original)
+++ trunk/examples/accelgroup.js	Sun Jan 18 00:57:13 2009
@@ -1,4 +1,5 @@
 #!/usr/bin/env seed
+
 Seed.import_namespace("Gtk")
 Seed.import_namespace("Gdk");
 
@@ -21,7 +22,7 @@
 	var label = new Label({label: "Press Q to quit"});
 	w.add(label);
 	
-	w.set_size_request(300, 300);
+	w.resize(300, 300);
 	w.show_all();
 	
 	main();

Modified: trunk/examples/actions.js
==============================================================================
--- trunk/examples/actions.js	(original)
+++ trunk/examples/actions.js	Sun Jan 18 00:57:13 2009
@@ -1,4 +1,5 @@
 #!/usr/bin/env seed
+
 Seed.import_namespace("Gtk");
 Gtk.init(null, null);
 
@@ -62,4 +63,3 @@
 	main();
 }
 
-

Modified: trunk/examples/clutter-cairo.js
==============================================================================
--- trunk/examples/clutter-cairo.js	(original)
+++ trunk/examples/clutter-cairo.js	Sun Jan 18 00:57:13 2009
@@ -1,4 +1,5 @@
 #!/usr/bin/env seed
+
 Seed.import_namespace("Canvas");
 Seed.import_namespace("Clutter");
 Seed.import_namespace("ClutterCairo");
@@ -11,10 +12,10 @@
 ctx = new Canvas.CairoCanvas(cr);
 
 ctx.fillStyle = "rgb(200,0,0)";
-ctx.fillRect (10, 10, 55, 50);
+ctx.fillRect(10, 10, 55, 50);
 
 ctx.fillStyle = "rgba(0, 0, 200, 0.5)";
-ctx.fillRect (30, 30, 55, 50);
+ctx.fillRect(30, 30, 55, 50);
 
 c.width = c.height = 100;
 c.x = c.y = 100;

Modified: trunk/examples/clutter-cogl.js
==============================================================================
--- trunk/examples/clutter-cogl.js	(original)
+++ trunk/examples/clutter-cogl.js	Sun Jan 18 00:57:13 2009
@@ -1,4 +1,5 @@
 #!/usr/bin/env seed
+
 Seed.import_namespace("Clutter");
 Seed.import_namespace("GLib");
 
@@ -13,7 +14,7 @@
 const SCREEN_W = 640;
 const SCREEN_H = 480;
 
-function angle_from_deg(x)
+function deg_to_rad(x)
 {
 	return (((x) * 1024.0) / 360.0);
 }
@@ -38,8 +39,6 @@
 	else
 		return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
 										(time-=(2.625/2.75))*time+.984375);
-
-
 }
 
 function destroy_actor(actor)
@@ -56,13 +55,13 @@
 	Clutter.cogl_color(actor.fill_color);
 	Clutter.cogl_path_move_to(radius, radius);
 	Clutter.cogl_path_arc(radius, radius, radius, radius,
-						  angle_from_deg(0),
-						  angle_from_deg(360));
+						  deg_to_rad(0),
+						  deg_to_rad(360));
 	Clutter.cogl_path_line_to(radius - RIPPLE_WX/2, radius);
 	Clutter.cogl_path_arc(radius, radius, 
 						  radius-RIPPLE_WX/2, radius-RIPPLE_WX/2,
-						  angle_from_deg(0),
-						  angle_from_deg(360));
+						  deg_to_rad(0),
+						  deg_to_rad(360));
 	Clutter.cogl_path_close();
 	Clutter.cogl_path_fill();	
 }
@@ -71,7 +70,7 @@
 {
 	var transp = new Clutter.Color();
 	
-	var n = parseInt(Math.random()*RIPPLE_N)+1;
+	var n = parseInt(Math.random()*RIPPLE_N , 10) + 1;
 	
 	for (i = 0; i < n; i++)
 	{
@@ -80,9 +79,7 @@
 		actor.fill_color = new Clutter.Color({red: 0xff,
 											  green: 0xff,
 											  blue: 0xff});
-	
-
-
+		
 		var size = ((RIPPLE_W * 2) * (i+1)) + (RIPPLE_G * i);
 		
 		actor.width = actor.height = size;
@@ -100,18 +97,17 @@
 		Clutter.effect_fade(template, actor,
 							0x00,
 							destroy_actor);
-						
 	}
 }
 
 Clutter.init(null, null);
 
-var template = 
-	new Clutter.EffectTemplate.for_duration(RIPPLE_S,
-											alpha_func);
+var template = new Clutter.EffectTemplate.for_duration(RIPPLE_S, alpha_func);
 
 var stage = new Clutter.Stage();
-stage.width = SCREEN_W; stage.height = SCREEN_H;
+
+stage.width = SCREEN_W;
+stage.height = SCREEN_H;
 stage.color = {};
 
 stage.signal["button_press_event"].connect(
@@ -126,16 +122,12 @@
 
 function random_ripple()
 {
-	ripple(stage,
-		   Math.random()*SCREEN_W,
-		   Math.random()*SCREEN_H);
-	GLib.timeout_add(Math.random()*RIPPLE_MAXD + RIPPLE_MIND,
-					 random_ripple);
+	ripple(stage, Math.random()*SCREEN_W, Math.random()*SCREEN_H);
+	GLib.timeout_add(Math.random()*RIPPLE_MAXD + RIPPLE_MIND, random_ripple);
+	
 	return false;
 }
 
 random_ripple();
-
 Clutter.main();
 
-

Modified: trunk/examples/clutter.js
==============================================================================
--- trunk/examples/clutter.js	(original)
+++ trunk/examples/clutter.js	Sun Jan 18 00:57:13 2009
@@ -36,7 +36,6 @@
 	else
 		return Clutter.ALPHA_MAX_ALPHA*(7.5625 *
 										(time-=(2.625/2.75))*time+.984375);
-
 }
 
 var stage = new Clutter.Stage();
@@ -71,8 +70,10 @@
 	stage.add_actor(r);
 	rectangles[i] = r;
 }
+
 // Was initially intended as a test to see if performance was accetable to do
 // custom animations at 60fps. Turns out to be fine, serves as an example now.
+
 timeline.signal.new_frame.connect(
 	function(timeline, frame_num)
 	{
@@ -82,12 +83,13 @@
 			rectangles[i].rotation_angle_z += 1;
 		}
 	});
+
 timeline.signal.completed.connect(
 	function(timeline)
 	{
 		
 		var text = new Clutter.Label({text:"Congratulations!",
-									  font_name:"Bitstream Vera Sans 40"});
+									   font_name:"Bitstream Vera Sans 40"});
 		var fadeline = new Clutter.Timeline({fps:60, num_frames:200});
 		var effect = new Clutter.EffectTemplate.c_new(timeline, alpha_func);
 		
@@ -117,6 +119,5 @@
 	});
 
 timeline.start();
-
 Clutter.main();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]