当前位置:网站首页>网页游戏引擎
网页游戏引擎
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>
边栏推荐
- 中银证券网上开户安全吗?
- Spark 中的 Rebalance 操作以及与Repartition操作的区别
- 最大子数组与矩阵乘法
- [glide] cache implementation - memory and disk cache
- Oracle监听器Server端与Client端配置实例
- Accounting regulations and professional ethics [8]
- Task state rollback and data blocking tasks based on check point mechanism
- ~88 running people practice
- Redis 的内存淘汰策略和过期删除策略的区别
- Maximum subarray and matrix multiplication
猜你喜欢

Understand asp Net core - Authentication Based on jwtbearer

NoSQL之readis配置与优化(终章)

S2b2b solution for lighting industry: efficiently enable the industrial supply chain and improve the economic benefits of enterprises

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

Visual studio 2019 (localdb) mssqllocaldb SQL Server 2014 database version is 852 and cannot be opened. This server supports 782

一图看懂ThreadLocal

~89 deformation translation

leetcode:421. 数组中两个数的最大异或值

周大福践行「百周年承诺」,真诚服务推动绿色环保
Can you really use MySQL explain?
随机推荐
leetcode刷题目录总结
Redis: SDS source code analysis
[Acwing] 58周赛 4490. 染色
Market trend report, technical innovation and market forecast of taillight components in China
[Acwing] 58周赛 4489. 最长子序列
overflow:auto与felx结合的用法
Opencv learning -- geometric transformation of image processing
tp配置多数据库
跳跃表实例
基于check-point实现图数据构建任务
Research Report on plastic recycling machine industry - market status analysis and development prospect forecast
Go development: how to use go singleton mode to ensure the security of high concurrency of streaming media?
S2b2b solution for lighting industry: efficiently enable the industrial supply chain and improve the economic benefits of enterprises
Spark 中的 Rebalance 操作以及与Repartition操作的区别
[Chongqing Guangdong education] National Open University spring 2019 1248 public sector human resource management reference questions
智慧物流園區供應鏈管理系統解决方案:數智化供應鏈賦能物流運輸行業供應鏈新模式
China Indonesia adhesive market trend report, technological innovation and market forecast
FIREBIRD使用经验总结
Years of training, towards Kata 3.0! Enter the safe container experience out of the box | dragon lizard Technology
System.currentTimeMillis() 和 System.nanoTime() 哪个更快?别用错了!