# HG changeset patch # User Thinker K.F. Li # Date 1283217813 -28800 # Node ID cad706a8f5b1f5961c77e21c30a6c5e29c3cd173 # Parent bf2794eed7020078404db438d3020ecfedaaebc4 Simplify phone.js diff -r bf2794eed702 -r cad706a8f5b1 nodejs/phone.js --- 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();