当前位置:网站首页>网页游戏引擎
网页游戏引擎
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>
边栏推荐
- Use and principle of thread pool
- Research Report on market supply and demand and strategy of tetramethylpyrazine industry in China
- ~89 deformation translation
- Jump table instance
- 跳跃表实例
- Opencv learning -- geometric transformation of image processing
- Integration of ongdb graph database and spark
- Oracle监听器Server端与Client端配置实例
- PyTorch深度学习快速入门教程
- 智慧物流園區供應鏈管理系統解决方案:數智化供應鏈賦能物流運輸行業供應鏈新模式
猜你喜欢
Learn more about the basic situation of 2022pmp examination
Visual Studio 2019 (LocalDB)MSSQLLocalDB SQL Server 2014 数据库版本为852无法打开,此服务器支持782
2022年国内云管平台厂商哪家好?为什么?
overflow:auto与felx结合的用法
电子元器件B2B商城系统开发:赋能企业构建进销存标准化流程实例
Principle and general steps of SQL injection
Go micro tutorial - Chapter 2 go micro V3 using gin and etcd
被PMP考试“折磨”出来的考试心得,值得你一览
VMware Tools和open-vm-tools的安装与使用:解决虚拟机不全屏和无法传输文件的问题
How to implement a delay queue?
随机推荐
力扣今日题-1200. 最小绝对差
Spark 中的 Rebalance 操作以及与Repartition操作的区别
[glide] cache implementation - memory and disk cache
L1-072 scratch lottery
[acwing] 58 weeks 4489 Longest subsequence
Research Report on surgical otorhinolaryngology equipment industry - market status analysis and development prospect prediction
散列表
js中的数组筛选fliter
C# 服务器日志模块
Which domestic cloud management platform manufacturer is good in 2022? Why?
leetcode刷题目录总结
ECCV 2022放榜了:1629篇论文中选,录用率不到20%
Accounting regulations and professional ethics [9]
中银证券网上开户安全吗?
~89 deformation translation
Is it safe for Anxin securities to open an account online? Is the account opening fee charged
Visual Studio 2019 (LocalDB)MSSQLLocalDB SQL Server 2014 数据库版本为852无法打开,此服务器支持782
Configuration instance of Oracle listener server and client
Pytorch deep learning quick start tutorial
Firebird experience summary