Mercurial > MadButterfly
comparison nodejs/examples/mce/mainmenu.js @ 930:30cd14b11bc7
USe the graphics from the Max.
author | wycc |
---|---|
date | Sat, 06 Nov 2010 00:53:59 +0800 |
parents | 80000948fcde |
children | bd9b0142fc7e |
comparison
equal
deleted
inserted
replaced
929:d35f9702b8c2 | 930:30cd14b11bc7 |
---|---|
3 var svg = require("svg"); | 3 var svg = require("svg"); |
4 var mbapp = require("mbapp"); | 4 var mbapp = require("mbapp"); |
5 var sys=require("sys"); | 5 var sys=require("sys"); |
6 var animate=require("animate"); | 6 var animate=require("animate"); |
7 var fs = require("fs"); | 7 var fs = require("fs"); |
8 var EPG = require('./epg'); | |
8 | 9 |
9 function MainMenu(app) | 10 function MainMenu(app) |
10 { | 11 { |
11 var self = this; | 12 var self = this; |
12 app.loadSVG("desktop.svg"); | 13 //var epg = new EPG.EPG(); |
14 //epg.registerInitDone(function() { self.init();}); | |
15 self.init(); | |
16 } | |
17 MainMenu.prototype.init=function() | |
18 { | |
19 app.loadSVG("main.svg"); | |
13 | 20 |
14 this.video = app.get("video"); | 21 var i; |
15 this.audio = app.get("audio"); | 22 var self = this; |
16 this.picture = app.get("picture"); | 23 this.items=[]; |
17 this.setting = app.get("setting"); | 24 for(i=0;i<4;i++) { |
25 this.items.push(app.get("cat"+i)); | |
26 } | |
18 this.app = app; | 27 this.app = app; |
19 | 28 |
20 this.lightbar = app.get("lightbar"); | 29 this.lightbar = app.get("lightbar"); |
21 this.lines = []; | 30 this.lines = []; |
22 for(i = 0; i < 5; i++) { | 31 for(i = 0; i < 5; i++) { |
23 var line = app.get("line" + (i + 1)); | 32 var line = app.get("line" + (i + 1)); |
24 this.lines.push(line); | 33 this.lines.push(line); |
25 } | 34 } |
26 this.line=0; | 35 this.line=0; |
27 | |
28 this.items=[this.video, this.audio, this.picture, this.setting]; | |
29 this.item = 0; | 36 this.item = 0; |
30 | 37 |
31 animate.run([new animate.scale(app,this.items[this.item], 1, 1.5)], 0, 0.1); | 38 animate.run([new animate.scale(app,this.items[this.item], 1, 1.5)], 0, 0.1); |
32 app.refresh(); | 39 app.refresh(); |
33 | 40 |
54 | 61 |
55 var an = new animate.scale(this.app, old, 1, 1); | 62 var an = new animate.scale(this.app, old, 1, 1); |
56 animate.run([an], 0, 0.1); | 63 animate.run([an], 0, 0.1); |
57 an = new animate.scale(this.app, target, 1, 1.5); | 64 an = new animate.scale(this.app, target, 1, 1.5); |
58 animate.run([an], 0, 0.3); | 65 animate.run([an], 0, 0.3); |
66 var sx = target.center.x - this.lightbar.center.x; | |
67 var an = new animate.shift(this.app, this.lightbar, sx, 0); | |
68 animate.run([an], 0, 0.3); | |
59 } | 69 } |
60 | 70 |
61 MainMenu.prototype.key_right=function() | 71 MainMenu.prototype.key_right=function() |
62 { | 72 { |
63 var old = this.items[this.item]; | 73 var old = this.items[this.item]; |
73 target.bbox.update(); | 83 target.bbox.update(); |
74 | 84 |
75 var an = new animate.scale(this.app, old, 1, 1); | 85 var an = new animate.scale(this.app, old, 1, 1); |
76 animate.run([an], 0, 0.1); | 86 animate.run([an], 0, 0.1); |
77 an = new animate.scale(this.app, target, 1, 1.5); | 87 an = new animate.scale(this.app, target, 1, 1.5); |
88 animate.run([an], 0, 0.3); | |
89 var sx = target.center.x - this.lightbar.center.x; | |
90 var an = new animate.shift(this.app, this.lightbar, sx, 0); | |
78 animate.run([an], 0, 0.3); | 91 animate.run([an], 0, 0.3); |
79 } | 92 } |
80 | 93 |
81 MainMenu.prototype.key_up=function() | 94 MainMenu.prototype.key_up=function() |
82 { | 95 { |