annotate nodejs/testdesktop.js @ 822:586e50f82c1f

Unify coding style tag for emacs and vim.
author Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
date Tue, 14 Sep 2010 01:08:39 +0800
parents 7875e8026e86
children 2101a355acba
rev   line source
822
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 820
diff changeset
1 // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*-
586e50f82c1f Unify coding style tag for emacs and vim.
Shih-Yuan Lee (FourDollars) <fourdollars@gmail.com>
parents: 820
diff changeset
2 // vim: sw=4:ts=8:sts=4
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
3 var svg = require("./svg");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
4 var mbapp = require("./mbapp");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
5 var sys=require("sys");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
6 var animate=require("./animate");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
7 var fs = require("fs");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
8
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
9 app = new mbapp.app();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
10 app.loadSVG("desktop.svg");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
11
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
12 video = app.get("video");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
13 audio = app.get("audio");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
14 picture = app.get("picture");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
15 setting = app.get("setting");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
16 items=[video,audio,picture,setting];
776
77b561bb7929 Implement new algorithm to calculate the origin of the SVG elemnts so that we can implement object resize without changing the position of the object.
wycc
parents: 758
diff changeset
17 item = 0;
801
f84ccf1f59ae Add icons for the menu demo
wycc
parents: 776
diff changeset
18 an = new animate.scale(app,items[item],1,1.5,0.1);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
19 an.start();
820
7875e8026e86 Change the key from up/down to left/right
wycc
parents: 801
diff changeset
20 setInterval(function() {
7875e8026e86 Change the key from up/down to left/right
wycc
parents: 801
diff changeset
21
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
22
820
7875e8026e86 Change the key from up/down to left/right
wycc
parents: 801
diff changeset
23 }, 300);
7875e8026e86 Change the key from up/down to left/right
wycc
parents: 801
diff changeset
24 app.addKeyListener(mbapp.KEY_LEFT, function() {
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
25 var old = items[item];
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
26 item = item - 1;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
27 if (item == -1) {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
28 item = 0;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
29 return;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
30 }
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
31 var target = items[item];
758
d11b0900f03c Check in the dynamic menu example. Currently, it illustarte a bug in the renderer.
wycc
parents: 752
diff changeset
32 var an = new animate.scale(app,old,1,1,0.1);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
33 an.start();
801
f84ccf1f59ae Add icons for the menu demo
wycc
parents: 776
diff changeset
34 an = new animate.scale(app,target,1,1.5,0.3);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
35 an.start();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
36 });
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
37
820
7875e8026e86 Change the key from up/down to left/right
wycc
parents: 801
diff changeset
38 app.addKeyListener(mbapp.KEY_RIGHT, function() {
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
39 var old = items[item];
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
40 item = item + 1;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
41 if (item == items.length) {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
42 item = item - 1;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
43 return;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
44 }
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
45 var target = items[item];
758
d11b0900f03c Check in the dynamic menu example. Currently, it illustarte a bug in the renderer.
wycc
parents: 752
diff changeset
46 var an = new animate.scale(app,old,1,1,0.1);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
47 an.start();
801
f84ccf1f59ae Add icons for the menu demo
wycc
parents: 776
diff changeset
48 an = new animate.scale(app,target,1,1.5,0.3);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
49 an.start();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
50 });
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
51
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
52 app.loop();