用HTML显示3D大乐透模拟器(大乐透在线模拟)
zhezhongyun 2025-07-28 01:15 25 浏览
把代码复制在电脑文本文档中,文本文档后缀名改为html ,这样你就自己制作成功一个大乐透机选模拟器,来试试吧。
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>3D大乐透模拟器</title>
<style>
body {
font-family: 'Microsoft YaHei', sans-serif;
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
perspective: 1000px;
}
.container {
text-align: center;
}
h1 {
color: #e74c3c;
text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
margin-bottom: 30px;
}
.lottery-machine {
width: 300px;
height: 400px;
position: relative;
transform-style: preserve-3d;
animation: rotate 15s infinite linear;
margin: 0 auto 30px;
}
.machine-body {
position: absolute;
width: 100%;
height: 100%;
background: linear-gradient(145deg, #e74c3c, #c0392b);
border-radius: 20px;
box-shadow: 0 20px 40px rgba(0,0,0,0.3);
transform-style: preserve-3d;
}
.machine-top {
position: absolute;
width: 80%;
height: 15%;
background: #fff;
border-radius: 10px;
top: 10%;
left: 10%;
transform: translateZ(20px);
box-shadow: inset 0 0 10px rgba(0,0,0,0.2);
}
.ball-display {
position: absolute;
width: 80%;
height: 50%;
background: rgba(255,255,255,0.9);
border-radius: 15px;
top: 30%;
left: 10%;
transform: translateZ(30px);
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
padding: 10px;
box-sizing: border-box;
box-shadow: inset 0 0 15px rgba(0,0,0,0.1);
}
.ball {
width: 40px;
height: 40px;
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, #fff, #f1c40f);
display: flex;
justify-content: center;
align-items: center;
margin: 5px;
font-weight: bold;
color: #e74c3c;
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
transform-style: preserve-3d;
animation: ballFloat 3s infinite ease-in-out;
}
.ball:nth-child(2) {
animation-delay: 0.2s;
background: radial-gradient(circle at 30% 30%, #fff, #3498db);
}
.ball:nth-child(3) {
animation-delay: 0.4s;
background: radial-gradient(circle at 30% 30%, #fff, #2ecc71);
}
.ball:nth-child(4) {
animation-delay: 0.6s;
background: radial-gradient(circle at 30% 30%, #fff, #9b59b6);
}
.ball:nth-child(5) {
animation-delay: 0.8s;
background: radial-gradient(circle at 30% 30%, #fff, #e67e22);
}
.machine-bottom {
position: absolute;
width: 60%;
height: 10%;
background: #333;
border-radius: 5px;
bottom: 10%;
left: 20%;
transform: translateZ(15px);
}
.button {
position: absolute;
width: 60px;
height: 60px;
background: #f1c40f;
border-radius: 50%;
bottom: -30px;
left: 50%;
transform: translateX(-50%) translateZ(40px);
cursor: pointer;
display: flex;
justify-content: center;
align-items: center;
font-weight: bold;
color: #c0392b;
box-shadow: 0 10px 20px rgba(0,0,0,0.2);
transition: all 0.3s;
}
.button:hover {
background: #f39c12;
transform: translateX(-50%) translateZ(40px) scale(1.1);
}
.button:active {
transform: translateX(-50%) translateZ(40px) scale(0.95);
}
@keyframes rotate {
0% { transform: rotateY(0deg); }
100% { transform: rotateY(360deg); }
}
@keyframes ballFloat {
0%, 100% { transform: translateY(0) translateZ(0); }
50% { transform: translateY(-10px) translateZ(10px); }
}
.result {
margin-top: 50px;
background: rgba(255,255,255,0.8);
padding: 20px;
border-radius: 10px;
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
max-width: 500px;
}
.generated-numbers {
display: flex;
justify-content: center;
flex-wrap: wrap;
margin: 15px 0;
}
.result-ball {
width: 50px;
height: 50px;
border-radius: 50%;
background: #e74c3c;
color: white;
display: flex;
justify-content: center;
align-items: center;
margin: 5px;
font-weight: bold;
font-size: 20px;
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
.result-ball.blue {
background: #3498db;
}
</style>
</head>
<body>
<div class="container">
<h1>3D大乐透模拟器</h1>
<div class="lottery-machine">
<div class="machine-body">
<div class="machine-top"></div>
<div class="ball-display">
<div class="ball">?</div>
<div class="ball">?</div>
<div class="ball">?</div>
<div class="ball">?</div>
<div class="ball">?</div>
</div>
<div class="machine-bottom"></div>
<div class="button" onclick="generateNumbers()">抽奖</div>
</div>
</div>
<div class="result" id="result" style="display: none;">
<h2>本期开奖号码</h2>
<div class="generated-numbers" id="numbers"></div>
<p>祝您好运!下次开奖时间:<span id="next-draw"></span></p>
</div>
</div>
<script>
function generateNumbers() {
// 生成前区5个号码(1-35)
let frontNumbers = [];
while(frontNumbers.length < 5) {
let num = Math.floor(Math.random() * 35) + 1;
if(!frontNumbers.includes(num)) {
frontNumbers.push(num);
}
}
frontNumbers.sort((a, b) => a - b);
// 生成后区2个号码(1-12)
let backNumbers = [];
while(backNumbers.length < 2) {
let num = Math.floor(Math.random() * 12) + 1;
if(!backNumbers.includes(num)) {
backNumbers.push(num);
}
}
backNumbers.sort((a, b) => a - b);
// 显示结果
document.getElementById('result').style.display = 'block';
let numbersDiv = document.getElementById('numbers');
numbersDiv.innerHTML = '';
// 添加前区号码
frontNumbers.forEach(num => {
let ball = document.createElement('div');
ball.className = 'result-ball';
ball.textContent = num;
numbersDiv.appendChild(ball);
});
// 添加分隔符
let separator = document.createElement('div');
separator.style.display = 'flex';
separator.style.alignItems = 'center';
separator.innerHTML = '<span style="margin: 0 5px; font-size: 20px;">+</span>';
numbersDiv.appendChild(separator);
// 添加后区号码
backNumbers.forEach(num => {
let ball = document.createElement('div');
ball.className = 'result-ball blue';
ball.textContent = num;
numbersDiv.appendChild(ball);
});
// 设置下次开奖时间(假设是3天后)
let nextDraw = new Date();
nextDraw.setDate(nextDraw.getDate() + 3);
document.getElementById('next-draw').textContent = nextDraw.toLocaleDateString() + ' 20:00';
}
</script>
</body>
</html>
相关推荐
- Opinion丨Struggle Against U.S. Mind colonization in the Global South
-
Editor'snote:Thismonth,XinhuaNewsAgency'sThinkTankreleasedareporttitled"Colonizationof...
- 爱可可AI论文推介(2020.11.4)_爱可可女装旗舰店
-
LG-机器学习CV-计算机视觉CL-计算与语言AS-音频与语音RO-机器人(*表示值得重点关注)1、[LG]*CombiningLabelPropagationan...
- 何新:罗马伪史考英文版序言_罗马史学
-
2019-10-2514:48:27何新:罗马伪史考序言(英文译本)HeXin:PreambleofResearchonPseudo-historyofRome1Afewyear...
- XPeng Stock Rises Over 4% after Q2 Revenue and EV Margin Set Records
-
TMTPOST--TheAmericandepositaryreceipts(ADRs)ofXPengInc.rosearound4.2%onTuesdayaftert...
- 英汉世界语部首(八)_英文部首字典
-
本节讲八个部首,分别是:弓gōng【ECWLrad】bow廾gǒng【ECWLrad】twen广guǎng【ECWLrad】vast己jǐ【ECWLrad】self已yǐ...
- 一课译词:划水_划水是什么地方的方言
-
[Photo/SIPA]懒惰是人类的天性,因此才总有人会在工作时“划水”。“划水【huáshuǐ】”,本意是指“用胳膊划的动作(makestrokeswithone’sarms)”,延伸为“...
- 首测!GPT-4o做Code Review可行吗?
-
编辑|言征出品|51CTO技术栈(微信号:blog51cto)近日,OpenAI一记重拳,推出了GPT-4o(“o”表示“omni”),将语音识别和对话方面的优势展示的淋漓尽致。几乎可以肯定,...
- C++|漫谈STL细节及内部原理_c++ stl详解
-
1988年,AlexanderStepanov开始进入惠普的PaloAlto实验室工作,在随后的4年中,他从事的是有关磁盘驱动器方面的工作。直到1992年,由于参加并主持了实验室主任BillWo...
- C++ inline关键字深度解析:不止于优化的头文件定义许可
-
在C++开发中,几乎每个程序员都用过inline关键字,但多数人只停留在“内联优化”的表层理解。事实上,inline的真正威力在于它打破了C++的单一定义规则(ODR)限制,成为头文件中安全定义函数的...
- 实用 | 10分钟教你搭建一个嵌入式web服务器
-
之前分享的文章中提到了几种可以在嵌入式中使用的web服务器。嵌入式web服务器就是把web服务器移植到嵌入式系统的服务器。它仍然是基于http文本协议进行通信的,具有标准的接口形式,对客户端...
- 中间语言格式_中间格式文本是什么
-
在通常情况下,编译器会将目标语言转换成某种中间语言格式,而不是直接将源代码转换成二进制机器指令,不少c语言编译器,都会将代码编译成汇编语言,然后再通过汇编语言编译器将汇编代码转换成目标机器可执行的二进...
- 一线开发大牛带你深度解析探讨模板解释器,解释器的生成
-
解释器生成解释器的机器代码片段都是在TemplateInterpreterGenerator::generate_all()中生成的,下面将分小节详细展示该函数的具体细节,以及解释器某个组件的机器代码...
- 干货,Web开发和前端开发逆天工具大全
-
微信ID:WEB_wysj(点击关注)◎◎◎◎◎◎◎◎◎一┳═┻︻▄(点击页底“阅读原文”前往下载)●●●逆天工具CDN资源库国内Bootstrap中文网开源项目免费CDN服务36...
- 移动端rem+vw适配_移动端web页面适配方案
-
rem:rem是相对单位,设置根元素html的font-size,比如给html设置字体大小为100px,1rem=100px;rem缺点:1.和根元素font-size值强耦合,系统字...
- 从零搭建 React 开发 H5 模板_react html5
-
项目创建创建项目文件夹mkdir react-democd react-demonpm init -y依赖安装yarn add rea...
- 一周热门
- 最近发表
-
- Opinion丨Struggle Against U.S. Mind colonization in the Global South
- 爱可可AI论文推介(2020.11.4)_爱可可女装旗舰店
- 何新:罗马伪史考英文版序言_罗马史学
- XPeng Stock Rises Over 4% after Q2 Revenue and EV Margin Set Records
- 英汉世界语部首(八)_英文部首字典
- 一课译词:划水_划水是什么地方的方言
- 首测!GPT-4o做Code Review可行吗?
- C++|漫谈STL细节及内部原理_c++ stl详解
- C++ inline关键字深度解析:不止于优化的头文件定义许可
- 实用 | 10分钟教你搭建一个嵌入式web服务器
- 标签列表
-
- HTML 教程 (33)
- HTML 简介 (35)
- HTML 实例/测验 (32)
- HTML 测验 (32)
- JavaScript 和 HTML DOM 参考手册 (32)
- HTML 拓展阅读 (30)
- HTML文本框样式 (31)
- HTML滚动条样式 (34)
- HTML5 浏览器支持 (33)
- HTML5 新元素 (33)
- HTML5 WebSocket (30)
- HTML5 代码规范 (32)
- HTML5 标签 (717)
- HTML5 标签 (已废弃) (75)
- HTML5电子书 (32)
- HTML5开发工具 (34)
- HTML5小游戏源码 (34)
- HTML5模板下载 (30)
- HTTP 状态消息 (33)
- HTTP 方法:GET 对比 POST (33)
- 键盘快捷键 (35)
- 标签 (226)
- HTML button formtarget 属性 (30)
- opacity 属性 (32)
- transition 属性 (33)