js实现两人数学运算比赛触摸屏拔河游戏代码
代码语言:html
所属分类:游戏
代码描述:js实现两人数学运算比赛触摸屏拔河游戏代码
代码标签: js 两人 数学 运算 比赛 触摸屏 拔河 游戏 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>数学拔河比赛</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
font-family: 'Microsoft YaHei', Arial, sans-serif;
background: linear-gradient(180deg, #4facfe 0%, #87CEEB 40%, #98e898 70%, #68c968 100%);
height: 100vh;
overflow: hidden;
user-select: none;
}
/* ===== 开始界面 ===== */
.overlay {
position: fixed; top: 0; left: 0; right: 0; bottom: 0;
display: flex; flex-direction: column; justify-content: center; align-items: center;
z-index: 200; color: #fff;
}
#startScreen {
background: linear-gradient(135deg, #667eea, #764ba2);
}
#startScreen h1 { font-size: 44px; text-shadow: 3px 3px 6px rgba(0,0,0,.3); margin-bottom: 8px; }
#startScreen .sub { font-size: 18px; opacity: .9; margin-bottom: 30px; }
.emoji-big { font-size: 70px; margin-bottom: 18px; }
.diff-row { display: flex; gap: 14px; margin-bottom: 28px; }
.diff-btn {
padding: 14px 22px; font-size: 16px; border: 3px solid #fff;
border-radius: 14px; background: transparent; color: #fff;
cursor: pointer; transition: .3s; text-align: center; line-height: 1.5;
}
.diff-btn:hover, .diff-btn.on { background: rgba(255,255,255,.35); transform: scale(1.06); }
.go-btn {
padding: 16px 56px; font-size: 26px; font-weight: bold;
border: none; border-radius: 50px; color: #fff; cursor: pointer;
background: linear-gradient(135deg, #f093fb, #f5576c);
box-shadow: 0 6px 24px rgba(0,0,0,.3); transition: .3s;
animation: glow 2s infinite alternate;
}
.go-btn:hover { transform: scale(1.06); }
@keyframes glow {
from { box-shadow: 0 6px 24px rgba(240,147,251,.3); }
to { box-shadow: 0 6px 36px rgba(245,87,108,.6); }
}
/* ===== 倒计时 ===== */
#countdownScreen { background: rgba(0,0,0,.75); display: none; }
#countdownScreen.show { display: flex; }
.cd-num {
font-size: 160px; font-weight: bold;
text-shadow: 0 0 40px rgba(255,255,255,.7);
animation: pop .7s ease;
}
@keyframes pop {
0% { transform: scale(2.5); opacity: 0; }
60% { transform: scale(1.1); opacity: 1; }
100%{ transform: scale(1); }
}
/* ===== 结果界面 ===== */
#resultScreen { background: rgba(0,0,0,.85); display: none; }
#resultScreen.show { display: flex; }
#resultScreen h1 { font-size: 46px; animation: pop .8s ease; margin-bottom: 6px; }
.res-emoji { font-size: 80px; animation: pop 1s ease; margin-bottom: 10px; }
.res-cards { display: flex; gap: 40px; margin-bottom: 18px; }
.res-card {
text-align: center; padding: 22px 36px; border-radius: 16px;
animation: slideU .7s ease;
}
.res-card.win { background: linear-gradient(135deg,#FFD700,#FFA500); box-shadow: 0 0 30px rgba(255,215,0,.5); }
.res-card.lose { background: rgba(255,255,255,.15); }
.res-card h2 { font-size: 22px; margin-bottom: 6px; }
.res-card .big { font-size: 44px; font-weight: bold; }
.res-detail { font-size: 15px; opacity: .85; line-height: 1.9; text-align: center; margin-bottom: 18px; }
.again-btn {
padding: 14px 50px; font-size: 22px; font-weight: bold;
border: none; border.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0