comparison nodejs/testdesktop.js @ 752:ffbf9910213c

Add testdesktop,js example. Add animation.scale module.
author wycc
date Thu, 26 Aug 2010 09:53:15 +0800
parents
children d11b0900f03c
comparison
equal deleted inserted replaced
751:9f4a1134ec82 752:ffbf9910213c
1 var svg = require("./svg");
2 var mbapp = require("./mbapp");
3 var sys=require("sys");
4 var animate=require("./animate");
5 var fs = require("fs");
6
7 app = new mbapp.app();
8 app.loadSVG("desktop.svg");
9
10 video = app.get("video");
11 audio = app.get("audio");
12 picture = app.get("picture");
13 setting = app.get("setting");
14 items=[video,audio,picture,setting];
15 item = 2;
16 an = new animate.scale(app,items[item],1,1.5,0.3);
17 an.start();
18
19 app.addKeyListener(mbapp.KEY_UP, function() {
20 var old = items[item];
21 item = item - 1;
22 if (item == -1) {
23 item = 0;
24 return;
25 }
26 var target = items[item];
27 var an = new animate.scale(app,old,1,1,0.3);
28 an.start();
29 an = new animate.scale(app,target,1,1.5,0.3);
30 an.start();
31 });
32
33 app.addKeyListener(mbapp.KEY_DOWN, function() {
34 var old = items[item];
35 item = item + 1;
36 if (item == items.length) {
37 item = item - 1;
38 return;
39 }
40 var target = items[item];
41 var an = new animate.scale(app,old,1,1,0.3);
42 an.start();
43 an = new animate.scale(app,target,1,1.5,0.3);
44 an.start();
45 });
46
47 app.loop();