Flash中背景跟随时间变化

2008-04-02 11:02:39来源:互联网 阅读 ()

新老客户大回馈,云服务器低至5折


  假如flash中,我们想实现一张图片随着电脑时间的变换,图片也发生变化,形成早晨,晚上等效果。(假如多个图片,也能用这个方法实现,下面,我们看一下案例):

  

  

  


  相对应的脚本:

  
functiontimes()

  {

  hh=newDate();

  xiaoshi=hh.getHours();

  mm=newDate();

  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];

  }//endif

  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];

  }//endif

  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];

  }//endif

  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];

  }//endif

  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];

  }//endif

  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];

  }//endif

  if(nowtime>390&&nowtime<=870)

  {

  skycolor=[100,(nowtime-390)*0.062500,100,(nowtime-390)*0.062500,100,(nowtime-390)*0.062500,100,0];

  }//endif

  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];

  }//endif

  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];

  }//endif

  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];

  }//endif

  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];

  }//endif

  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];

  }//endif

  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];

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇: Flash动画的“遮丑”研究

下一篇: 用AS控制MC的倾斜属性