annotate nodejs/testdesktop.js @ 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. However, the image does not work here since it does not use the transformation of the group.
author wycc
date Mon, 30 Aug 2010 08:56:44 +0800
parents d11b0900f03c
children f84ccf1f59ae
rev   line source
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
1 var svg = require("./svg");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
2 var mbapp = require("./mbapp");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
3 var sys=require("sys");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
4 var animate=require("./animate");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
5 var fs = require("fs");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
6
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
7 app = new mbapp.app();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
8 app.loadSVG("desktop.svg");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
9
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
10 video = app.get("video");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
11 audio = app.get("audio");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
12 picture = app.get("picture");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
13 setting = app.get("setting");
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
14 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
15 item = 0;
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 an = new animate.scale(app,items[item],1,2,10);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
17 an.start();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
18
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
19 app.addKeyListener(mbapp.KEY_UP, function() {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
20 var old = items[item];
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
21 item = item - 1;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
22 if (item == -1) {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
23 item = 0;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
24 return;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
25 }
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
26 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
27 var an = new animate.scale(app,old,1,1,0.1);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
28 an.start();
758
d11b0900f03c Check in the dynamic menu example. Currently, it illustarte a bug in the renderer.
wycc
parents: 752
diff changeset
29 an = new animate.scale(app,target,1,2,0.3);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
30 an.start();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
31 });
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
32
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
33 app.addKeyListener(mbapp.KEY_DOWN, function() {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
34 var old = items[item];
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
35 item = item + 1;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
36 if (item == items.length) {
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
37 item = item - 1;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
38 return;
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
39 }
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
40 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
41 var an = new animate.scale(app,old,1,1,0.1);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
42 an.start();
758
d11b0900f03c Check in the dynamic menu example. Currently, it illustarte a bug in the renderer.
wycc
parents: 752
diff changeset
43 an = new animate.scale(app,target,1,2,0.3);
752
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
44 an.start();
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
45 });
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
46
ffbf9910213c Add testdesktop,js example.
wycc
parents:
diff changeset
47 app.loop();