超酷图片变换

<script>
var ticked=0;
var okayToGo = true;
var currentCreature = 1;	
var forwardBackward = 1;									 
var theNewContainer = 1;
var theOldContainer = 2;
function toggleContainers()
{
  theNewContainer = (theNewContainer == 1) ? 2 : 1;
  theOldContainer = (theOldContainer == 1) ? 2 : 1;
}
function moveItem(thisCreature){
  if(okayToGo&& thisCreature != currentCreature){
        toggleContainers();
        
	newCreature = thisCreature;											
	document.getElementById("y"+theNewContainer).style.zIndex = 50+10*forwardBackward;		
	document.getElementById("y"+theOldContainer).style.zIndex = 50+20*forwardBackward;	    
	startTheMove = window.setInterval("rightOrLeft()",20);		
  }
}
function rightOrLeft()											
{
  if (ticked == 1020)											
  {
    window.clearInterval(startTheMove);	
        ticked = 0;						
	forwardBackward = 1;										
	currentCreature = newCreature;								
    okayToGo = true;											
  }
  else
  {
    okayToGo = false;											
	thisAngle = (Math.PI/2)*(ticked/1000);						
	document.getElementById("y"+theNewContainer).style.left = " "+(735-Math.sin(thisAngle)*700)+"px"; 
	document.getElementById("y"+theNewContainer).style.top = " "+(105-(forwardBackward*Math.cos(thisAngle)*55))+"px"; 
	document.getElementById("y"+theOldContainer).style.left = " "+(735-Math.sin(thisAngle+Math.PI/2)*700)+"px"; 
	document.getElementById("y"+theOldContainer).style.top = " "+(105-(forwardBackward*Math.cos(thisAngle+Math.PI/2)*55))+"px"; 
	ticked += 20;												
  }
}
</script>
<a href="javascript:moveItem(1);"><img src="http://t4.baidu.com/it/u=2900771931,2776220722&gp=6.jpg"></a>
<a href="javascript:moveItem(2);"><img src="http://t2.baidu.com/it/u=2879406521,1676348574&gp=44.jpg"></a>
<div align="right" style="position:absolute; right:5px; top:10px; height:435px; width:650px; overflow:hidden;background:#fff">
<div id="y1" style="position:absolute; left:35px; margin-top:20px; top:105px; z-index:90; width:100px;height:100px;background:#ffffff"><img src="http://www.sjjia.com/shoujitupian/downfileq/rhd/97908f1b2rhdqfn.jpg"></div>
<div id="y2" style="position:absolute; left:700px; margin-top:20px; top:105px; z-index:90; width:100px;height:100px;background:#ffffff"><img src="http://www.16277.com/caitu/uploadfile/2007/3/28/1057394275129.jpg"></div>
</div>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值