changeset 793:cad706a8f5b1

Simplify phone.js
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 31 Aug 2010 09:23:33 +0800
parents bf2794eed702
children a27606be2cab
files nodejs/phone.js
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/nodejs/phone.js	Tue Aug 31 02:58:01 2010 +0800
+++ b/nodejs/phone.js	Tue Aug 31 09:23:33 2010 +0800
@@ -46,15 +46,15 @@
 }
 
 var sw = 0;
+var dock_up = new animate.linear(app, dock, 0, -300, 0.5);
+var dock_down = new animate.linear(app, dock, 0, 0, 0.5);
 dock.mouse_event.add_event_observer(4, function(evt) {
 	if(sw == 0) {
-	    var an = new animate.linear(app, dock, 0, -300, 0.5);
-	    an.start();
+	    dock_up.start();
 	} else {
-	    var an = new animate.linear(app, dock, 0, 0, 0.5);
-	    an.start();
+	    dock_down.start();
 	}
-	sw = (sw + 1) % 2;
+	sw = sw ^ 1;
     });
 
 app.loop();