当前位置:网站首页>Web game engine
Web game engine
2022-07-04 17:15:00 【The fifth brother of the Wang family】
Web game engine - Partially Prepared Products
Sample code :
<!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 Axis
* @param {Object} y Axis
* @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>
边栏推荐
- Readis configuration and optimization of NoSQL (final chapter)
- APOC自定义函数和过程
- Unity interview questions (continuously updated)
- [acwing] 58 weeks 4490 dyeing
- Implement graph data construction task based on check point
- .Net 应用考虑x64生成
- Height residual method
- 太方便了,钉钉上就可完成代码发布审批啦!
- Sql实现Split
- The Ministry of human resources and Social Security announced the new construction occupation
猜你喜欢

Start by counting

Overflow: the combination of auto and Felx

矿产行业商业供应链协同系统解决方案:构建数智化供应链平台,保障矿产资源安全供应

Chow Tai Fook fulfills the "centenary commitment" and sincerely serves to promote green environmental protection

How to implement a delay queue?

世界环境日 | 周大福用心服务推动减碳环保

如何实现一个延时队列 ?

Go micro tutorial - Chapter 2 go micro V3 using gin and etcd

Congratulations to Mr. Zhang Pengfei, chief data scientist of artefact, for winning the campaign Asia tech MVP 2022

Position encoding practice in transformer
随机推荐
Object. Usage of keys()
嵌入式软件架构设计-函数调用
跳跃表实例
FIREBIRD使用经验总结
线性时间排序
Blood spitting finishing nanny level series tutorial - play Fiddler bag grabbing tutorial (2) - first meet fiddler, let you have a rational understanding
"Cannot initialize Photoshop because the temporary storage disk is full" graphic solution
TP configuring multiple databases
Understand Alibaba cloud's secret weapon "dragon architecture" in the article "science popularization talent"
矿产行业商业供应链协同系统解决方案:构建数智化供应链平台,保障矿产资源安全供应
ONgDB图数据库与Spark的集成
C# 实现 FFT 正反变换 和 频域滤波
智慧物流園區供應鏈管理系統解决方案:數智化供應鏈賦能物流運輸行業供應鏈新模式
Overflow: the combination of auto and Felx
一图看懂ThreadLocal
It's too convenient. You can complete the code release and approval by nailing it!
一加10 Pro和iPhone 13怎么选?
科普达人丨一文看懂阿里云的秘密武器“神龙架构”
Unity interview questions (continuously updated)
[Chongqing Guangdong education] National Open University spring 2019 1248 public sector human resource management reference questions