varSpriteWhirl=function(imgIndex,orgX,orgY,speed){this.index=imgIndex;this.speed=speed;2、this.pos_x=orgX;this.pos_y=orgY;this.range_x=$(window).width()-100;this.range_y=$(window).height()-100;this.arr=["resources/01.png","resources/02.png","resources/03.png","resources/04.png","resources/05.png"];this.imageObj=$("
");this.imageObj.css("position","absolute");this.imag
3、eObj.css("width","100px");this.imageObj.css("height","100px");this.imageObj.attr({"src":this.arr[imgIndex],"isSpirit":"true"});this.imageObj.appendTo("body");};SpriteWhirl.prototype.gogo=function(){if(this.pos_x==0&&this.pos_ythis.ra
4、nge_y){this.pos_y=this.range_y;}}elseif(this.pos_xthis.range_x){this.pos_x=this.range_x;}}elseif(this.pos_x==this.range_x&&this.pos_y<=this.range_y&&this.pos_y!=0){this.pos_y-=this.speed;if(this.pos_y<0){thi
5、s.pos_y=0;}}elseif(this.pos_x<=this.range_x&&this.pos_y==0&&this.pos_x!=0){this.pos_x-=this.speed;if(this.pos_x<0)this.pos_x=0;}this.imageObj.css({"left":this.pos_x,"top":this.pos_y});};SpriteWhirl.prototype.run=function(){vartemp=this;setInterval(function(){temp.gogo();},1);};functio
6、nwindowSizeChanged(){$("img[isSpirit=true]").remove();main();}functionmain(){vara=newSpriteWhirl(0,$(window).width()-100,0,1);a.run();varb=newSpriteWhirl(1,0,$(window).height()-100,3);b.run();varc=newSpriteWhirl(2,0,$(window).height()-150,5);c.run();vard=newSpriteWhirl(3,0,$(window).h
7、eight()-200,7);d.run();vare=newSpriteWhirl(4,$(window).width()-150,0,10);e.run();}