diff nodejs/mbapp.js @ 1376:4c5bcaba28ea

Check in so that we can check the crash issues.
author wycc
date Fri, 11 Mar 2011 14:07:55 +0800
parents 593a418ed8bf
children f0a156705977
line wrap: on
line diff
--- a/nodejs/mbapp.js	Fri Mar 11 14:05:09 2011 +0800
+++ b/nodejs/mbapp.js	Fri Mar 11 14:07:55 2011 +0800
@@ -145,6 +145,30 @@
     }
 }
 
+app.prototype.generateScaleTween=function(src,dest,p) {
+    sys.puts("p="+ p);
+    if (p == 0) {
+	if (src.dup) src.dup.hide();
+	src.show();
+	return;
+    }
+    src.hide();
+    // Duplicate the group
+    if (src.dup == null) {
+        dup = src.parent.clone_from_subtree(src);
+	src.dup = dup;
+    } else {
+	dup = src.dup;
+    }
+    dup.hide();
+    sys.puts(dup);
+
+
+    for(n in dup) {
+	
+        
+    }
+}
 
 app.prototype.changeScene=function(s) {
     var nth;
@@ -156,10 +180,21 @@
 	if (nth == -1) return;
     }
     var scenes = this.svg.scenes;
-    for(i=0;i<scenes.length;i++) {
+    for(i=0;i<scenes.length-1;i++) {
         try {
             if (nth >=scenes[i].start && nth <=scenes[i].end) {
-	        this.get(scenes[i].ref).show();
+		if (scenes[i].type == 'normal' || i == scenes.length-1) {
+	            this.get(scenes[i].ref).show();
+		} else if (scenes[i].type == 'scale') {
+		    if (scenes[i].end == (scenes[i+1].start-1)) {
+			var p = (nth-scenes[i].start)/(scenes[i].end-scenes[i].start+1);
+			this.generateScaleTween(this.get(scenes[i].ref),this.get(scenes[i+1].ref),p);
+		    } else {
+		        // If there is no second key frame defined, fall back to the normal
+	                this.get(scenes[i].ref).show();
+		    }
+		}
+
 	    } else {
 	        this.get(scenes[i].ref).hide();
 	    }