annotate nodejs/testdesktop.js @ 801:f84ccf1f59ae

Add icons for the menu demo
author wycc
date Wed, 01 Sep 2010 02:01:40 +0800
parents 77b561bb7929
children 7875e8026e86
rev   line source
801
f84ccf1f59ae Add icons for the menu demo
wycc
parents: 776
diff changeset
1 // vim: ts=4
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
2 var svg = require("./svg");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
3 var mbapp = require("./mbapp");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
4 var sys=require("sys");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
5 var animate=require("./animate");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
6 var fs = require("fs");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
7
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
8 app = new mbapp.app();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
9 app.loadSVG("desktop.svg");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
10
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
11 video = app.get("video");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
12 audio = app.get("audio");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
13 picture = app.get("picture");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
14 setting = app.get("setting");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
15 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
16 item = 0;
801
f84ccf1f59ae Add icons for the menu demo
wycc
parents: 776
diff changeset
17 an = new animate.scale(app,items[item],1,1.5,0.1);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
18 an.start();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
19
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
20 app.addKeyListener(mbapp.KEY_UP, function() {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
21 var old = items[item];
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
22 item = item - 1;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
23 if (item == -1) {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
24 item = 0;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
25 return;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
26 }
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
27 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
28 var an = new animate.scale(app,old,1,1,0.1);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
29 an.start();
801
f84ccf1f59ae Add icons for the menu demo
wycc
parents: 776
diff changeset
30 an = new animate.scale(app,target,1,1.5,0.3);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
31 an.start();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
32 });
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
33
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
34 app.addKeyListener(mbapp.KEY_DOWN, function() {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
35 var old = items[item];
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
36 item = item + 1;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
37 if (item == items.length) {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
38 item = item - 1;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
39 return;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
40 }
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
41 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
42 var an = new animate.scale(app,old,1,1,0.1);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
43 an.start();
801
f84ccf1f59ae Add icons for the menu demo
wycc
parents: 776
diff changeset
44 an = new animate.scale(app,target,1,1.5,0.3);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
45 an.start();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
46 });
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
47
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
48 app.loop();