Mercurial > MadButterfly
comparison 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 |
comparison
equal
deleted
inserted
replaced
1375:37dc1ce76bba | 1376:4c5bcaba28ea |
---|---|
143 this.keymap[k] = f; | 143 this.keymap[k] = f; |
144 } | 144 } |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 app.prototype.generateScaleTween=function(src,dest,p) { | |
149 sys.puts("p="+ p); | |
150 if (p == 0) { | |
151 if (src.dup) src.dup.hide(); | |
152 src.show(); | |
153 return; | |
154 } | |
155 src.hide(); | |
156 // Duplicate the group | |
157 if (src.dup == null) { | |
158 dup = src.parent.clone_from_subtree(src); | |
159 src.dup = dup; | |
160 } else { | |
161 dup = src.dup; | |
162 } | |
163 dup.hide(); | |
164 sys.puts(dup); | |
165 | |
166 | |
167 for(n in dup) { | |
168 | |
169 | |
170 } | |
171 } | |
148 | 172 |
149 app.prototype.changeScene=function(s) { | 173 app.prototype.changeScene=function(s) { |
150 var nth; | 174 var nth; |
151 if (typeof(s)=='number') { | 175 if (typeof(s)=='number') { |
152 var i; | 176 var i; |
154 } else { | 178 } else { |
155 nth = this.svg.getFrameNumber(s); | 179 nth = this.svg.getFrameNumber(s); |
156 if (nth == -1) return; | 180 if (nth == -1) return; |
157 } | 181 } |
158 var scenes = this.svg.scenes; | 182 var scenes = this.svg.scenes; |
159 for(i=0;i<scenes.length;i++) { | 183 for(i=0;i<scenes.length-1;i++) { |
160 try { | 184 try { |
161 if (nth >=scenes[i].start && nth <=scenes[i].end) { | 185 if (nth >=scenes[i].start && nth <=scenes[i].end) { |
162 this.get(scenes[i].ref).show(); | 186 if (scenes[i].type == 'normal' || i == scenes.length-1) { |
187 this.get(scenes[i].ref).show(); | |
188 } else if (scenes[i].type == 'scale') { | |
189 if (scenes[i].end == (scenes[i+1].start-1)) { | |
190 var p = (nth-scenes[i].start)/(scenes[i].end-scenes[i].start+1); | |
191 this.generateScaleTween(this.get(scenes[i].ref),this.get(scenes[i+1].ref),p); | |
192 } else { | |
193 // If there is no second key frame defined, fall back to the normal | |
194 this.get(scenes[i].ref).show(); | |
195 } | |
196 } | |
197 | |
163 } else { | 198 } else { |
164 this.get(scenes[i].ref).hide(); | 199 this.get(scenes[i].ref).hide(); |
165 } | 200 } |
166 } catch(e) { | 201 } catch(e) { |
167 sys.puts(e); | 202 sys.puts(e); |