seed r161 - trunk/examples



Author: racarr
Date: Fri Nov  7 14:14:24 2008
New Revision: 161
URL: http://svn.gnome.org/viewvc/seed?rev=161&view=rev

Log:
Make a reasonable alpha example for clutter test.


Modified:
   trunk/examples/clutter.js

Modified: trunk/examples/clutter.js
==============================================================================
--- trunk/examples/clutter.js	(original)
+++ trunk/examples/clutter.js	Fri Nov  7 14:14:24 2008
@@ -23,9 +23,23 @@
 	    timeline = alpha.get_timeline();
 	    frame = timeline.get_current_frame();
 	    n_frames = timeline.num_frames;
+	    fps = timeline.fps;
+	    duration = n_frames/fps;
+	    time = frame/fps;
 	    
-	    return (frame * Clutter.ALPHA_MAX_ALPHA)/n_frames;
-    }   
+	    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);
+	    else if (time < (2.5/2.75))
+		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);
+	    
+    }
     catch (e)
     {
 	    Seed.print(e.message);
@@ -92,9 +106,14 @@
 		text.anchor_y = text.height/2;
 		
 		text.x = stage.width/2;
-		text.y = stage.height/2;
+		//text.y = stage.height/2;
+		text.y = -text.height;
+		Clutter.effect_move(effect,
+				    text,
+				    text.x,
+				    stage.height/2);
 		
-		Clutter.effect_fade(effect,text,0);
+			    //		Clutter.effect_fade(effect,text,0);
 		for (i in rectangles)
 		{
 			Clutter.effect_move(effect, rectangles[i], 



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