// --- 申请执行代码 ---
var appid = APPID;
TASK[appid] = {
	'packname': 'com.elitecloud.system'
};
++APPID;
// --- 创建桌布 ---
var mainWin = new Window(appid);
mainWin.size = [window.innerWidth, window.innerHeight];
mainWin.x = 0;
mainWin.y = 0;
mainWin.borderStyle = 'none';
mainWin.styleBackgroundImage = 'url(images/loginbg.jpg)';
mainWin.styleBackgroundSize = 'cover';
mainWin.onResize = function() {
	mainWin_canvas.setSize(mainWin.width, mainWin.height);
};
// --- 创建 3D 画布 ---
var mainWin_canvas = new Canvas({alpha:true});
mainWin_canvas.setSize(mainWin.width, mainWin.height);
mainWin.add(mainWin_canvas);
// --- 创建镜头 ---
mainWin_camera = new ThreeJS.PerspectiveCamera(80, mainWin.width / mainWin.height, 1, 4000);
mainWin_camera.position.z = 1000;
mainWin_scene = new ThreeJS.Scene();
mainWin_scene.add(mainWin_camera);
// --- 创建星星 ---
var mainWin_particles = [];
for(var zpos=-3000;zpos<1000;zpos+=40){
	var mainWin_material = new ThreeJS.ParticleCanvasMaterial({color:0xffffff, program:function(context) {
		context.beginPath();
		context.arc(0, 0, .2, 0,  Math.PI * 2, true);
		context.fill();
	}});
	var mainWin_particle = new ThreeJS.Particle(mainWin_material);
	mainWin_particle.position.x = Math.random()*3000-1500;
	mainWin_particle.position.y = Math.random()*3000-1500;
	mainWin_particle.position.z = zpos;
	mainWin_particle.scale.x = mainWin_particle.scale.y = 10;
	mainWin_scene.add(mainWin_particle);
	mainWin_particles.push(mainWin_particle);
}
// --- 创建滚动效果 ---
var mainWin_timer = setInterval(function() {
	for(var i=0; i< mainWin_particles.length; i++) {
		var particle = mainWin_particles[i];
		particle.position.z += 30;
		if(particle.position.z > 1000) {
			particle.position.z -= 4000;
			particle.position.x = Math.random()*3000-1500;
			particle.position.y = Math.random()*3000-1500;
		}
	}
	mainWin_canvas.render(mainWin_scene, mainWin_camera);
}, 1000/30);

RESOLUTIONCHANGE[appid] = function(w, h) {
	mainWin.size = [w, h];
};