碰撞运动 crash.html
来源:互联网 发布:知乎 swatch秒针掉了 编辑:程序博客网 时间:2024/06/05 03:34
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <title></title> <style> #div1{width:100px;height:100px;background: red;position:absolute;} </style> <script> function startMove(){ var oDiv=document.getElementById('div1'); var iSpeedX=30; var iSpeedY=8; setInterval(function(){ iSpeedY+=3; var l=oDiv.offsetLeft+iSpeedX; var t=oDiv.offsetTop+iSpeedY; if(t>=document.documentElement.clientHeight-oDiv.offsetHeight){ iSpeedY*=-0.8; iSpeedX*=0.8; t=document.documentElement.clientHeight-oDiv.offsetHeight; }else if(t<=0){ iSpeedY*=-1; iSpeedX*=0.8; t=0; } if(l>=document.documentElement.clientWidth-oDiv.offsetWidth){ iSpeedX*=-0.8; l=document.documentElement.clientWidth-oDiv.offsetWidth; }else if(l<=0){ iSpeedX*=-0.8; l=0; } if(Math.abs(iSpeedX)<1){ iSpeedX=0; } if(Math.abs(iSpeedY)<1){ iSpeedY=0; } oDiv.style.left=l+'px'; oDiv.style.top=t+'px'; },30); } </script></head><body><input id="ipt1" type="button" value="开始运动" onclick="startMove()"><div id="div1"></div></body></html>
1 0
- 碰撞运动 crash.html
- 碰撞运动
- js运动-碰撞运动
- 拖拽+碰撞+重力下的运动damp.html
- js缓冲运动、弹性运动、碰撞运动
- 碰撞运动js
- POJ2674运动碰撞模拟
- 重力+拖拽+碰撞运动
- 碰撞检测与模型运动
- nbut 台球碰撞 物理-运动
- JavaScript 动画之碰撞运动
- OpenGL 碰撞检测与模型运动
- XNA 两球碰撞的运动规律
- OpenGL 碰撞检测与模型运动
- OpenGL碰撞检测与模型运动
- NBUT 1462 台球碰撞(物理运动)
- 二维运动物体简单碰撞判断
- 运动物体碰撞算法演示【转】
- 很好的一个关于maven工程创建的文章
- Spring 注解 new创建对象后失效
- 如何在不引用头文件的情况下调用category里面的方法
- Spring重试支持Spring Retry
- Request的getParameter和getAttribute方法的区别
- 碰撞运动 crash.html
- 30.Substring with Concatenation of All Words
- Java的参数传递到底是引用传递还是值传递
- jquery日期控件WdatePicker的使用
- C-运算符优先级一个小例子
- 最大流模板1
- session_set_save_handler()函数注意细节
- cocos2dx shader在android上失效
- SQL的Join