当前位置:网站首页>网页游戏引擎
网页游戏引擎
2022-07-04 15:18:00 【王家五哥】
网页游戏引擎-半成品
示例代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div style="width: 500px;height: 400px;border: solid 1px;">
<div id="kuaiBut" style="width:20px;height:20px;background-color:green;">
</div>
</div>
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
var sunDun = 10;
setInterval(function() {
sunDun++;
console.log(sunDun);
moveFun('kuaiBut', 'left', 'top', sunDun);
if (sunDun >= 600) {
sunDun = 0;
}
}, 20)
})
/**
* @param {Object} x 轴
* @param {Object} y 轴
* @param {Object} lengt
*/
function moveFun(id, x, y, lengt) {
let pdWidth = $("#" + id).parent().width();
let pdheight = $("#" + id).parent().height();
console.log(pdWidth + ' - ' + pdheight);
if (y == '' || y == null || y == undefined) {
$("#" + id).css(x, lengt + 'px');
} else {
$("#" + id).css(x, lengt + 'px');
$("#" + id).css(y, lengt + 'px');
}
$("#" + id).css('position', 'absolute');
}
</script>
</html>
边栏推荐
- Accounting regulations and professional ethics [7]
- Maximum subarray and matrix multiplication
- 智慧物流园区供应链管理系统解决方案:数智化供应链赋能物流运输行业供应链新模式
- Market trend report, technical innovation and market forecast of tetrabromophthalate (pht4 diol) in China
- Transformer中position encoding实践
- Task state rollback and data blocking tasks based on check point mechanism
- China tall oil fatty acid market trend report, technical dynamic innovation and market forecast
- Go语言循环语句(第10课下)
- Oracle监听器Server端与Client端配置实例
- Market trend report, technical innovation and market forecast of taillight components in China
猜你喜欢

对人胜率84%,DeepMind AI首次在西洋陆军棋中达到人类专家水平

VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题

基于wifi控制的51单片机温度报警器
Why do you say that the maximum single table of MySQL database is 20million? Based on what?

Solution du système de gestion de la chaîne d'approvisionnement du parc logistique intelligent

DC-2靶场搭建及渗透实战详细过程(DC靶场系列)

Detailed process of DC-2 range construction and penetration practice (DC range Series)

C# 服务器日志模块

新的职业已经出现,怎么能够停滞不前 ,人社部公布建筑新职业

容器环境minor gc异常频繁分析
随机推荐
Object.keys()的用法
L1-072 scratch lottery
Statistical learning: logistic regression and cross entropy loss (pytoch Implementation)
~88 running people practice
Accounting regulations and professional ethics [10]
如何实现一个延时队列 ?
Maximum subarray and matrix multiplication
[acwing] 58 weeks 4490 dyeing
Opencv learning -- geometric transformation of image processing
Research Report on market supply and demand and strategy of China's Sodium Tetraphenylborate (cas+143-66-8) industry
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
C# 更加优质的操作MongoDB数据库
Analysis of abnormal frequency of minor GC in container environment
. Net applications consider x64 generation
Market trend report, technical innovation and market forecast of electrochromic glass and devices in China and Indonesia
NoSQL之readis配置与优化(终章)
Practice: fabric user certificate revocation operation process
Solution du système de gestion de la chaîne d'approvisionnement du parc logistique intelligent
C# 服务器日志模块
World Environment Day | Chow Tai Fook serves wholeheartedly to promote carbon reduction and environmental protection