function times()
{
hh = new Date();
xiaoshi = hh.getHours();
mm = new Date();
fengzhong = mm.getMinutes();
nowtime = xiaoshi * 60 + fengzhong;
if (nowtime >= 0 && nowtime <= 300 || nowtime > 1200 && nowtime < 1440)
{
skycolor = [5, 18, 7, -14, 29, -10, 100, 0];
} // end if
if (nowtime > 300 && nowtime <= 330)
{
skycolor = [5 + (nowtime - 300) * 1.500000, 18 - (nowtime - 300) * 2.930000, 7 + (nowtime - 300) * 1.200000, -14 - (nowtime - 300) * 1.230000, 29 + (nowtime - 300), -10 - (nowtime - 300) * 1.330000, 100, 0];
} // end if
if (nowtime > 330 && nowtime <= 350)
{
skycolor = [49 + (nowtime - 330) * 1.050000, -70, 43 + (nowtime - 330) * 1.100000, -51, 58 + (nowtime - 330) * 0.600000, -50, 100, 0];
} // end if
if (nowtime > 350 && nowtime <= 360)
{
skycolor = [70 - (nowtime - 350) * 2.100000, -70 + (nowtime - 350) * 12.100000, 65 + (nowtime - 350) * 0.700000, -51 + (nowtime - 350) * 1.800000, 70 - (nowtime - 350) * 1.400000, -50 + (nowtime - 350) * 5, 100, 0];
} // end if
if (nowtime > 360 && nowtime <= 375)
{
skycolor = [49 + (nowtime - 361) * 0.357100, 51 + (nowtime - 361) * 3.071000, 72 - (nowtime - 361) * 1.285700, -33 + (nowtime - 361) * 5.710000, 56, 0 + (nowtime - 361) * 5, 100, 0];
} // end if
if (nowtime > 375 && nowtime <= 390)
{
skycolor = [54 + (nowtime - 375) * 3.067000, 94 - (nowtime - 375) * 5.875000, 54 + (nowtime - 375) * 3.067000, 47 - (nowtime - 375) * 3.133000, 54 + (nowtime - 375) * 3.067000, 70 - (nowtime - 375) * 4.667000, 100, 0];
} // end if
if (nowtime > 390 && nowtime <= 870)
{
skycolor = [100, (nowtime - 390) * 0.062500, 100, (nowtime - 390) * 0.062500, 100, (nowtime - 390) * 0.062500, 100, 0];
} // end if
if (nowtime > 870 && nowtime <= 990)
{
skycolor = [100, 30 - (nowtime - 870) * 0.250000, 100, 30 - (nowtime - 870) * 0.250000, 100, 30 - (nowtime - 870) * 0.250000, 100, 0];
} // end if
if (nowtime > 990 && nowtime <= 1050)
{
skycolor = [100 - (nowtime - 990) * 0.167000, (nowtime - 990) * 0.767000, 100 - (nowtime - 990) * 0.167000, 0, 100 - (nowtime - 990) * 0.167000, 0, 100, 0];
} // end if
if (nowtime > 1050 && nowtime <= 1070)
{
skycolor = [90 + (nowtime - 1050) * 0.500000, 46 + (nowtime - 1050) * 6.250000, 90 + (nowtime - 1050) * 0.500000, -(nowtime - 1050) * 0.250000, 90 - (nowtime - 1050) * 0.800000, -(nowtime - 1050) * 2.100000, 100, 0];
} // end if
if (nowtime > 1070 && nowtime <= 1080)
{
skycolor = [100 - (nowtime - 1070) * 1.700000, 171 - (nowtime - 1070) * 6, 100 - (nowtime - 1070) * 1.700000, -5, 74 - (nowtime - 1070) * 0.900000, -42 + (nowtime - 1070) * 5.500000, 100, 0];
} // end if
if (nowtime > 1080 && nowtime <= 1110)
{
skycolor = [83 - (nowtime - 1080) * 0.433000, 111 - (nowtime - 1080) * 5.100000, 83 - (nowtime - 1080) * 0.433000, -5 - (nowtime - 1080) * 1.233000, 65 + (nowtime - 1080) * 0.366700, 13 - (nowtime - 1080) * 2, 100, 0];
} // end if
if (nowtime > 1110 && nowtime <= 1200)
{
skycolor = [70 - (nowtime - 1110) * 0.722000, -42 + (nowtime - 1110) * 0.667000, 70 - (nowtime - 1110) * 0.700000, -42 + (nowtime - 1110) * 0.310000, 76 - (nowtime - 1110) * 0.522000, -47 + (nowtime - 1110) * 0.411000, 100, 0];
} // end if
sk = new Color(sky);
x1 = {ra: skycolor[0], rb: skycolor[1], ga: skycolor[2], gb: skycolor[3], ba: skycolor[4], bb: skycolor[5], aa: skycolor[6], ab: skycolor[7]};
sk.setTransform(x1);
m1 = new Color(mc1);
x2 = {ra: m1color[0], rb: m1color[1], ga: m1color[2], gb: m1color[3], ba: m1color[4], bb: m1color[5], aa: m1color[6], ab: m1color[7]};
m1.setTransform(x2);
m2 = new Color(mc2);
x3 = {ra: m2color[0], rb: m2color[1], ga: m2color[2], gb: m2color[3], ba: m2color[4], bb: m2color[5], aa: m2color[6], ab: m2color[7]};
m2.setTransform(x3);
m3 = new Color(mc3);
x4 = {ra: m3color[0], rb: m3color[1], ga: m3color[2], gb: m3color[3], ba: m3color[4], bb: m3color[5], aa: m3color[6], ab: m3color[7]};
m3.setTransform(x4);
m4 = new Color(mc4);
x5 = {ra: m4color[0], rb: m4color[1], ga: m4color[2], gb: m4color[3], ba: m4color[4], bb: m4color[5], aa: m4color[6], ab: m4color[7]};
m4.setTransform(x5);
d = new Color(dao);
x6 = {ra: dcolor[0], rb: dcolor[1], ga: dcolor[2], gb: dcolor[3], ba: dcolor[4], bb: dcolor[5], aa: dcolor[6], ab: dcolor[7]};
d.setTransform(x6);
y1 = new Color(yun1);
y2 = new Color(yun2);
y3 = new Color(yun3);
sun = new Color(mc5);
x7 = {ra: yuncolor[0], rb: yuncolor[1], ga: yuncolor[2], gb: yuncolor[3], ba: yuncolor[4], bb: yuncolor[5], aa: yuncolor[6], ab: yuncolor[7]};
y1.setTransform(x7);
y2.setTransform(x7);
y3.setTransform(x7);
sun = new Color(mc5);
sun.setTransform(x4);
sky2 = new Color(_root.home.all.sky2);
sky2.setTransform(x1);
} // End of the function
function suntimes()
{
if (nowtime >= 540 && nowtime <= 900)
{
mc5._y = -45;
if (nowtime <= 720)
{
mc5._rotation = 180 + (nowtime - 540) * 0.388000;
} // end if
if (nowtime > 720)
{
mc5._rotation = 250 + (nowtime - 720) * 0.611000;
} // end if
}
else
{
if (nowtime < 540 && nowtime >= 360)
{
mc5._y = 180 - (nowtime - 360) * 1.250000;
mc5._rotation = 180;
} // end if
if (nowtime >= 900 && nowtime <= 1110)
{
mc5._y = -45 + (nowtime - 900) * 0.900000;
mc5._rotation = 0;
} // end if
if (nowtime >= 0 && nowtime < 360 || nowtime > 1100 && nowtime <= 1440)
{
mc5._alpha = 0;
}
else
{
mc5._alpha = 100;
} // end if
} // end if
if (nowtime > 360 && nowtime <= 720)
{
mc5.sun._xscale = 130 - (nowtime - 360) * 0.166700;
mc5.sun._yscale = mc5.sun._xscale;
}
else if (nowtime > 720 && nowtime <= 1080)
{
mc5.sun._xscale = 70 + (nowtime - 720) * 0.166700;
mc5.sun._yscale = mc5.sun._xscale;
} // end if
} // End of the function
function moontimes()
{
if (nowtime >= 1260 && nowtime < 1440 || nowtime >= 0 && nowtime < 180)
{
moon._y = -45;
if (nowtime < 1440)
{
moon._rotation = 180 + (nowtime - 1260) * 0.388900;
} // end if
if (nowtime >= 0 && nowtime < 180)
{
moon._rotation = 250 + nowtime * 0.611000;
} // end if
}
else
{
if (nowtime < 1260 && nowtime > 1080)
{
moon._y = 75 - (nowtime - 1080) * 0.666700;
moon._rotation = 180;
} // end if
if (nowtime > 180 && nowtime < 1080)
{
moon._y = -45 + (nowtime - 180) * 0.666700;
moon._rotation = 0;
} // end if
} // end if
if (nowtime >= 1080 && nowtime <= 1260)
{
moon._alpha = Math.round((nowtime - 1080) * 0.555600);
star._alpha = Math.round((nowtime - 1080) * 0.555600);
} // end if
if (nowtime > 1260 && nowtime < 1440 || nowtime > 0 && nowtime < 240)
{
moon._alpha = 100;
star._alpha = 100;
} // end if
if (nowtime >= 240 && nowtime <= 360)
{
moon._alpha = 100 - Math.round((nowtime - 240) * 0.833300);
star._alpha = 100 - Math.round((nowtime - 240) * 0.833300);
} // end if
if (nowtime > 360 && nowtime < 1080)
{
moon._alpha = 0;
star._alpha = 0;
} // end if
if (nowtime > 1080 && nowtime < 1440)
{
moon.moons._xscale = 130 - (nowtime - 1080) * 0.138890;
moon.moons._yscale = moon.moons._xscale;
}
else if (nowtime > 0 && nowtime <= 360)
{
moon.moons._xscale = 80 + nowtime * 0.138890;
moon.moons._yscale = moon.moons._xscale;
} // end if
} // End of the function
var hh;
var xiaoshi;
var mm;
var ss;
var fengzhong;
var nowtime;
MovieClip.prototype.moveIn = function ()
{
var _l1 = this;
_l1.onEnterFrame = function ()
{
var _l1 = this;
if (_l1._currentframe < _l1._totalframes)
{
_l1.nextFrame();
}
else
{
delete _l1["onEnterFrame"];
} // end if
};
};
MovieClip.prototype.moveOut = function ()
{
var _l1 = this;
_l1.gotoAndStop(_l1._totalframes);
_l1.onEnterFrame = function ()
{
var _l1 = this;
if (_l1._currentframe > 1)
{
_l1.prevFrame();
}
else
{
delete _l1["onEnterFrame"];
} // end if
};
};
onEnterFrame = function ()
{
ss = new Date();
miao = ss.getSeconds();
if (miao == 59)
{
times();
suntimes();
moontimes();
} // end if
};
{
hh = new Date();
xiaoshi = hh.getHours();
mm = new Date();
fengzhong = mm.getMinutes();
nowtime = xiaoshi * 60 + fengzhong;
if (nowtime >= 0 && nowtime <= 300 || nowtime > 1200 && nowtime < 1440)
{
skycolor = [5, 18, 7, -14, 29, -10, 100, 0];
} // end if
if (nowtime > 300 && nowtime <= 330)
{
skycolor = [5 + (nowtime - 300) * 1.500000, 18 - (nowtime - 300) * 2.930000, 7 + (nowtime - 300) * 1.200000, -14 - (nowtime - 300) * 1.230000, 29 + (nowtime - 300), -10 - (nowtime - 300) * 1.330000, 100, 0];
} // end if
if (nowtime > 330 && nowtime <= 350)
{
skycolor = [49 + (nowtime - 330) * 1.050000, -70, 43 + (nowtime - 330) * 1.100000, -51, 58 + (nowtime - 330) * 0.600000, -50, 100, 0];
} // end if
if (nowtime > 350 && nowtime <= 360)
{
skycolor = [70 - (nowtime - 350) * 2.100000, -70 + (nowtime - 350) * 12.100000, 65 + (nowtime - 350) * 0.700000, -51 + (nowtime - 350) * 1.800000, 70 - (nowtime - 350) * 1.400000, -50 + (nowtime - 350) * 5, 100, 0];
} // end if
if (nowtime > 360 && nowtime <= 375)
{
skycolor = [49 + (nowtime - 361) * 0.357100, 51 + (nowtime - 361) * 3.071000, 72 - (nowtime - 361) * 1.285700, -33 + (nowtime - 361) * 5.710000, 56, 0 + (nowtime - 361) * 5, 100, 0];
} // end if
if (nowtime > 375 && nowtime <= 390)
{
skycolor = [54 + (nowtime - 375) * 3.067000, 94 - (nowtime - 375) * 5.875000, 54 + (nowtime - 375) * 3.067000, 47 - (nowtime - 375) * 3.133000, 54 + (nowtime - 375) * 3.067000, 70 - (nowtime - 375) * 4.667000, 100, 0];
} // end if
if (nowtime > 390 && nowtime <= 870)
{
skycolor = [100, (nowtime - 390) * 0.062500, 100, (nowtime - 390) * 0.062500, 100, (nowtime - 390) * 0.062500, 100, 0];
} // end if
if (nowtime > 870 && nowtime <= 990)
{
skycolor = [100, 30 - (nowtime - 870) * 0.250000, 100, 30 - (nowtime - 870) * 0.250000, 100, 30 - (nowtime - 870) * 0.250000, 100, 0];
} // end if
if (nowtime > 990 && nowtime <= 1050)
{
skycolor = [100 - (nowtime - 990) * 0.167000, (nowtime - 990) * 0.767000, 100 - (nowtime - 990) * 0.167000, 0, 100 - (nowtime - 990) * 0.167000, 0, 100, 0];
} // end if
if (nowtime > 1050 && nowtime <= 1070)
{
skycolor = [90 + (nowtime - 1050) * 0.500000, 46 + (nowtime - 1050) * 6.250000, 90 + (nowtime - 1050) * 0.500000, -(nowtime - 1050) * 0.250000, 90 - (nowtime - 1050) * 0.800000, -(nowtime - 1050) * 2.100000, 100, 0];
} // end if
if (nowtime > 1070 && nowtime <= 1080)
{
skycolor = [100 - (nowtime - 1070) * 1.700000, 171 - (nowtime - 1070) * 6, 100 - (nowtime - 1070) * 1.700000, -5, 74 - (nowtime - 1070) * 0.900000, -42 + (nowtime - 1070) * 5.500000, 100, 0];
} // end if
if (nowtime > 1080 && nowtime <= 1110)
{
skycolor = [83 - (nowtime - 1080) * 0.433000, 111 - (nowtime - 1080) * 5.100000, 83 - (nowtime - 1080) * 0.433000, -5 - (nowtime - 1080) * 1.233000, 65 + (nowtime - 1080) * 0.366700, 13 - (nowtime - 1080) * 2, 100, 0];
} // end if
if (nowtime > 1110 && nowtime <= 1200)
{
skycolor = [70 - (nowtime - 1110) * 0.722000, -42 + (nowtime - 1110) * 0.667000, 70 - (nowtime - 1110) * 0.700000, -42 + (nowtime - 1110) * 0.310000, 76 - (nowtime - 1110) * 0.522000, -47 + (nowtime - 1110) * 0.411000, 100, 0];
} // end if
sk = new Color(sky);
x1 = {ra: skycolor[0], rb: skycolor[1], ga: skycolor[2], gb: skycolor[3], ba: skycolor[4], bb: skycolor[5], aa: skycolor[6], ab: skycolor[7]};
sk.setTransform(x1);
m1 = new Color(mc1);
x2 = {ra: m1color[0], rb: m1color[1], ga: m1color[2], gb: m1color[3], ba: m1color[4], bb: m1color[5], aa: m1color[6], ab: m1color[7]};
m1.setTransform(x2);
m2 = new Color(mc2);
x3 = {ra: m2color[0], rb: m2color[1], ga: m2color[2], gb: m2color[3], ba: m2color[4], bb: m2color[5], aa: m2color[6], ab: m2color[7]};
m2.setTransform(x3);
m3 = new Color(mc3);
x4 = {ra: m3color[0], rb: m3color[1], ga: m3color[2], gb: m3color[3], ba: m3color[4], bb: m3color[5], aa: m3color[6], ab: m3color[7]};
m3.setTransform(x4);
m4 = new Color(mc4);
x5 = {ra: m4color[0], rb: m4color[1], ga: m4color[2], gb: m4color[3], ba: m4color[4], bb: m4color[5], aa: m4color[6], ab: m4color[7]};
m4.setTransform(x5);
d = new Color(dao);
x6 = {ra: dcolor[0], rb: dcolor[1], ga: dcolor[2], gb: dcolor[3], ba: dcolor[4], bb: dcolor[5], aa: dcolor[6], ab: dcolor[7]};
d.setTransform(x6);
y1 = new Color(yun1);
y2 = new Color(yun2);
y3 = new Color(yun3);
sun = new Color(mc5);
x7 = {ra: yuncolor[0], rb: yuncolor[1], ga: yuncolor[2], gb: yuncolor[3], ba: yuncolor[4], bb: yuncolor[5], aa: yuncolor[6], ab: yuncolor[7]};
y1.setTransform(x7);
y2.setTransform(x7);
y3.setTransform(x7);
sun = new Color(mc5);
sun.setTransform(x4);
sky2 = new Color(_root.home.all.sky2);
sky2.setTransform(x1);
} // End of the function
function suntimes()
{
if (nowtime >= 540 && nowtime <= 900)
{
mc5._y = -45;
if (nowtime <= 720)
{
mc5._rotation = 180 + (nowtime - 540) * 0.388000;
} // end if
if (nowtime > 720)
{
mc5._rotation = 250 + (nowtime - 720) * 0.611000;
} // end if
}
else
{
if (nowtime < 540 && nowtime >= 360)
{
mc5._y = 180 - (nowtime - 360) * 1.250000;
mc5._rotation = 180;
} // end if
if (nowtime >= 900 && nowtime <= 1110)
{
mc5._y = -45 + (nowtime - 900) * 0.900000;
mc5._rotation = 0;
} // end if
if (nowtime >= 0 && nowtime < 360 || nowtime > 1100 && nowtime <= 1440)
{
mc5._alpha = 0;
}
else
{
mc5._alpha = 100;
} // end if
} // end if
if (nowtime > 360 && nowtime <= 720)
{
mc5.sun._xscale = 130 - (nowtime - 360) * 0.166700;
mc5.sun._yscale = mc5.sun._xscale;
}
else if (nowtime > 720 && nowtime <= 1080)
{
mc5.sun._xscale = 70 + (nowtime - 720) * 0.166700;
mc5.sun._yscale = mc5.sun._xscale;
} // end if
} // End of the function
function moontimes()
{
if (nowtime >= 1260 && nowtime < 1440 || nowtime >= 0 && nowtime < 180)
{
moon._y = -45;
if (nowtime < 1440)
{
moon._rotation = 180 + (nowtime - 1260) * 0.388900;
} // end if
if (nowtime >= 0 && nowtime < 180)
{
moon._rotation = 250 + nowtime * 0.611000;
} // end if
}
else
{
if (nowtime < 1260 && nowtime > 1080)
{
moon._y = 75 - (nowtime - 1080) * 0.666700;
moon._rotation = 180;
} // end if
if (nowtime > 180 && nowtime < 1080)
{
moon._y = -45 + (nowtime - 180) * 0.666700;
moon._rotation = 0;
} // end if
} // end if
if (nowtime >= 1080 && nowtime <= 1260)
{
moon._alpha = Math.round((nowtime - 1080) * 0.555600);
star._alpha = Math.round((nowtime - 1080) * 0.555600);
} // end if
if (nowtime > 1260 && nowtime < 1440 || nowtime > 0 && nowtime < 240)
{
moon._alpha = 100;
star._alpha = 100;
} // end if
if (nowtime >= 240 && nowtime <= 360)
{
moon._alpha = 100 - Math.round((nowtime - 240) * 0.833300);
star._alpha = 100 - Math.round((nowtime - 240) * 0.833300);
} // end if
if (nowtime > 360 && nowtime < 1080)
{
moon._alpha = 0;
star._alpha = 0;
} // end if
if (nowtime > 1080 && nowtime < 1440)
{
moon.moons._xscale = 130 - (nowtime - 1080) * 0.138890;
moon.moons._yscale = moon.moons._xscale;
}
else if (nowtime > 0 && nowtime <= 360)
{
moon.moons._xscale = 80 + nowtime * 0.138890;
moon.moons._yscale = moon.moons._xscale;
} // end if
} // End of the function
var hh;
var xiaoshi;
var mm;
var ss;
var fengzhong;
var nowtime;
MovieClip.prototype.moveIn = function ()
{
var _l1 = this;
_l1.onEnterFrame = function ()
{
var _l1 = this;
if (_l1._currentframe < _l1._totalframes)
{
_l1.nextFrame();
}
else
{
delete _l1["onEnterFrame"];
} // end if
};
};
MovieClip.prototype.moveOut = function ()
{
var _l1 = this;
_l1.gotoAndStop(_l1._totalframes);
_l1.onEnterFrame = function ()
{
var _l1 = this;
if (_l1._currentframe > 1)
{
_l1.prevFrame();
}
else
{
delete _l1["onEnterFrame"];
} // end if
};
};
onEnterFrame = function ()
{
ss = new Date();
miao = ss.getSeconds();
if (miao == 59)
{
times();
suntimes();
moontimes();
} // end if
};
特别说明:这个代码最下面不是用来控制背景变化的,而是用来控制到了晚上月亮出现的位置,星星的位置。白天这些画面消失的控制。由于时间缘故。本人没有将这些画面放上了。如果大家感兴趣的话。我后面会完成的。
.- 上一篇:JSP使用Resin连接池的方法
- 下一篇:用Flash制作搜索索引