seed r590 - trunk/examples/lightsoff



Author: hortont
Date: Wed Dec 31 02:23:46 2008
New Revision: 590
URL: http://svn.gnome.org/viewvc/seed?rev=590&view=rev

Log:
Continued LO reorg.


Modified:
   trunk/examples/lightsoff/arrow.js
   trunk/examples/lightsoff/board.js
   trunk/examples/lightsoff/light.js

Modified: trunk/examples/lightsoff/arrow.js
==============================================================================
--- trunk/examples/lightsoff/arrow.js	(original)
+++ trunk/examples/lightsoff/arrow.js	Wed Dec 31 02:23:46 2008
@@ -8,9 +8,7 @@
 		this.set_arrow_direction = function (dir)
 		{
 			var bkg;
-			
 			flipped = dir;
-			this.remove_all();
 
 			if(dir)
 				bkg = Clutter.Texture.new_from_file("./arrow-r.svg");

Modified: trunk/examples/lightsoff/board.js
==============================================================================
--- trunk/examples/lightsoff/board.js	(original)
+++ trunk/examples/lightsoff/board.js	Wed Dec 31 02:23:46 2008
@@ -3,21 +3,21 @@
 
 function alpha_func(alpha)
 {
-	timeline = alpha.get_timeline();
-	frame = timeline.get_current_frame();
-	n_frames = timeline.num_frames;
-	fps = timeline.fps;
-	duration = n_frames/fps;
-	time = frame/fps;
+	var timeline = alpha.get_timeline();
+	var frame = timeline.get_current_frame();
+	var n_frames = timeline.num_frames;
+	var fps = timeline.fps;
+	var duration = n_frames/fps;
+	var time = frame/fps;
 
 	if ((time/=duration) < (1/2.75))
 		return Clutter.ALPHA_MAX_ALPHA*(7.5625*time*time);
 	else if (time < (2/2.75))
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625 * (time-=(1.5/2.75))*time+.75);
+		return Clutter.ALPHA_MAX_ALPHA*(7.5625*(time-=(1.5/2.75))*time+.75);
 	else if (time < (2.5/2.75))
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625 *(time-=(2.25/2.75))*time+.9375);
+		return Clutter.ALPHA_MAX_ALPHA*(7.5625*(time-=(2.25/2.75))*time+.9375);
 	else
-		return Clutter.ALPHA_MAX_ALPHA*(7.5625 * (time-=(2.625/2.75))*time+.984375);
+		return Clutter.ALPHA_MAX_ALPHA*(7.5625*(time-=(2.625/2.75))*time+.984375);
 }
 
 function delete_board(timeline, board)

Modified: trunk/examples/lightsoff/light.js
==============================================================================
--- trunk/examples/lightsoff/light.js	(original)
+++ trunk/examples/lightsoff/light.js	Wed Dec 31 02:23:46 2008
@@ -1,15 +1,18 @@
 var tile_svg_size = 200;
 
-var on_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size("./light-on.svg", tile_svg_size, tile_svg_size);
-var off_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size("./light-off.svg", tile_svg_size, tile_svg_size);
+var on_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size("./light-on.svg",
+													   tile_svg_size,
+													   tile_svg_size);
+var off_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size("./light-off.svg",
+														tile_svg_size,
+														tile_svg_size);
 
 var on_svg = GtkClutter.texture_new_from_pixbuf(on_pixbuf);
 var off_svg = GtkClutter.texture_new_from_pixbuf(off_pixbuf);
 
-on_svg.filter_quality = Clutter.TextureQuality.High;
-off_svg.filter_quality = Clutter.TextureQuality.High;
+on_svg.filter_quality = off_svg.filter_quality = Clutter.TextureQuality.High;
 
-LightType = {
+Light = new GType({
 	parent: Clutter.Group.type,
 	name: "Light",
 	class_init: function(klass, prototype)
@@ -17,13 +20,12 @@
 		prototype.flip = function (fadeline)
 		{
 			this.state = !this.state;
+			var new_scale = this.state ? 1 : .9;
 			
 			if(in_setup)
 			{
 				this.on.opacity = this.state * 255;
-				
-				this.scale_x = this.state?1:.9;
-				this.scale_y = this.state?1:.9;
+				this.scale_x = this.scale_y = new_scale;
 				
 				return true;
 			}
@@ -32,7 +34,7 @@
 													 Clutter.sine_inc_func);
 			
 			Clutter.effect_fade(effect, this.on, this.state * 255);
-			Clutter.effect_scale(effect, this, this.state?1:.9, this.state?1:.9);
+			Clutter.effect_scale(effect, this, new_scale, new_scale);
 
 			return true;
 		}
@@ -41,8 +43,7 @@
 	{
 		this.state = false;
 		
-		this.scale_x = .9;
-		this.scale_y = .9;
+		this.scale_x = this.scale_y = .9;
 		
 		this.on = new Clutter.CloneTexture({parent_texture: on_svg,
 											reactive: true});
@@ -61,7 +62,6 @@
 		
 		this.add_actor(this.off);
 		this.add_actor(this.on);
-		
-	}};
+	}
+});
 
-Light = new GType(LightType);



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