var Timeline=function(){ this.order=[]; this.add=function(timeout,func,log){ this.order.push({ timeout:timeout, func:func, log:log }) }; this.start=function(ff){ for(s in this.order){ (function(me){ var fn=me.func; var timeout=me.timeout; var log=me.log; timeout=Math.max(timeout-(ff||0),0); setTimeout(fn,timeout); })(this.order[s]) } } }
var s1=new Timeline(); s1.add(1,function(){ g(‘c_box‘).className=‘c_box c_box_rock‘; g(‘c_box‘).onclick=function(){ s2.start(); } }) //图片加载器 var imgs=[‘1.png‘,‘2.png‘,‘3.png‘]; for(s in imgs){ var img=new Image; img.onload=imgs_onload; img.src=imgs[s]; } var imgs_onload=function(){ imgs.pop(); if(imgs.length===0){ s1.start(); } }
时间: 2024-11-05 13:35:40