当前位置:网站首页>网页游戏引擎
网页游戏引擎
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>
边栏推荐
- Congratulations to Mr. Zhang Pengfei, chief data scientist of artefact, for winning the campaign Asia tech MVP 2022
- How to implement a delay queue?
- 电子元器件B2B商城系统开发:赋能企业构建进销存标准化流程实例
- 中信证券网上开户安全吗 开户收费吗
- 嵌入式软件架构设计-函数调用
- 安信证券手机版下载 网上开户安全吗
- Solution du système de gestion de la chaîne d'approvisionnement du parc logistique intelligent
- Redis 的内存淘汰策略和过期删除策略的区别
- 51 single chip microcomputer temperature alarm based on WiFi control
- 同构图与异构图CYPHER-TASK设计与TASK锁机制
猜你喜欢

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

Principle and general steps of SQL injection

How to decrypt worksheet protection password in Excel file

祝贺Artefact首席数据科学家张鹏飞先生荣获 Campaign Asia Tech MVP 2022

Which domestic cloud management platform manufacturer is good in 2022? Why?

智慧物流园区供应链管理系统解决方案:数智化供应链赋能物流运输行业供应链新模式

World Environment Day | Chow Tai Fook serves wholeheartedly to promote carbon reduction and environmental protection
Can you really use MySQL explain?

Understand ThreadLocal in one picture

Go development: how to use go singleton mode to ensure the security of high concurrency of streaming media?
随机推荐
~89 deformation translation
昆明三环闭合工程将经过这些地方,有在你家附近的吗?
Market trend report, technical innovation and market forecast of taillight components in China
Market trend report, technical innovation and market forecast of electrochromic glass and devices in China and Indonesia
Transformer中position encoding实践
Accounting regulations and professional ethics [10]
手里10万元存款买什么理财产品收益最高?
周大福践行「百周年承诺」,真诚服务推动绿色环保
Capvision Rongying's prospectus in Hong Kong was "invalid": it was strictly questioned by the CSRC and required supplementary disclosure
Go语言循环语句(第10课下)
System.currentTimeMillis() 和 System.nanoTime() 哪个更快?别用错了!
Object.keys()的用法
Opencv learning -- geometric transformation of image processing
C# 实现 FFT 正反变换 和 频域滤波
散列表
Research Report on plastic recycling machine industry - market status analysis and development prospect forecast
.Net 应用考虑x64生成
话里话外:流程图绘制初级:六大常见错误
js中的数组筛选fliter
[glide] cache implementation - memory and disk cache