# HG changeset patch # User wycc # Date 1282787595 -28800 # Node ID ffbf9910213c2d0af1457f20acee4b30aa7d21cd # Parent 9f4a1134ec825e3e2e6aebcf3dcbd4d002a3e640 Add testdesktop,js example. Add animation.scale module. diff -r 9f4a1134ec82 -r ffbf9910213c nodejs/desktop.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nodejs/desktop.svg Thu Aug 26 09:53:15 2010 +0800 @@ -0,0 +1,108 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff -r 9f4a1134ec82 -r ffbf9910213c nodejs/testdesktop.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/nodejs/testdesktop.js Thu Aug 26 09:53:15 2010 +0800 @@ -0,0 +1,47 @@ +var svg = require("./svg"); +var mbapp = require("./mbapp"); +var sys=require("sys"); +var animate=require("./animate"); +var fs = require("fs"); + +app = new mbapp.app(); +app.loadSVG("desktop.svg"); + +video = app.get("video"); +audio = app.get("audio"); +picture = app.get("picture"); +setting = app.get("setting"); +items=[video,audio,picture,setting]; +item = 2; +an = new animate.scale(app,items[item],1,1.5,0.3); +an.start(); + +app.addKeyListener(mbapp.KEY_UP, function() { + var old = items[item]; + item = item - 1; + if (item == -1) { + item = 0; + return; + } + var target = items[item]; + var an = new animate.scale(app,old,1,1,0.3); + an.start(); + an = new animate.scale(app,target,1,1.5,0.3); + an.start(); +}); + +app.addKeyListener(mbapp.KEY_DOWN, function() { + var old = items[item]; + item = item + 1; + if (item == items.length) { + item = item - 1; + return; + } + var target = items[item]; + var an = new animate.scale(app,old,1,1,0.3); + an.start(); + an = new animate.scale(app,target,1,1.5,0.3); + an.start(); +}); + +app.loop();