QQ农场风格HTML游戏
以下是一个华丽的QQ农场风格HTML游戏代码,包含丰富的动画和特效,符合现代审美。
<!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>
:root {
--primary-color: #4CAF50;
--secondary-color: #8BC34A;
--accent-color: #FFC107;
--dark-color: #388E3C;
--light-color: #DCEDC8;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Arial', sans-serif;
}
body {
background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
min-height: 100vh;
overflow-x: hidden;
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 15px 0;
margin-bottom: 20px;
border-bottom: 2px solid var(--primary-color);
}
.logo {
font-size: 28px;
font-weight: bold;
color: var(--primary-color);
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
}
.logo i {
margin-right: 10px;
font-size: 32px;
}
.user-info {
display: flex;
align-items: center;
gap: 20px;
}
.user-level {
background: linear-gradient(45deg, var(--accent-color), #FF9800);
color: white;
padding: 8px 15px;
border-radius: 20px;
font-weight: bold;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
}
.user-level i {
margin-right: 5px;
}
.coins {
background: linear-gradient(45deg, #FFC107, #FF9800);
color: white;
padding: 8px 15px;
border-radius: 20px;
font-weight: bold;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
display: flex;
align-items: center;
}
.coins i {
margin-right: 5px;
}
.main-content {
display: flex;
gap: 20px;
}
.sidebar {
width: 250px;
background: white;
border-radius: 10px;
padding: 15px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
height: fit-content;
}
.sidebar-title {
font-size: 18px;
font-weight: bold;
margin-bottom: 15px;
color: var(--primary-color);
display: flex;
align-items: center;
gap: 8px;
}
.inventory {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 10px;
}
.inventory-item {
background: var(--light-color);
border-radius: 8px;
padding: 10px;
text-align: center;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
overflow: hidden;
}
.inventory-item:hover {
transform: translateY(-3px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}
.inventory-item img {
width: 50px;
height: 50px;
object-fit: contain;
margin-bottom: 5px;
transition: transform 0.3s ease;
}
.inventory-item:hover img {
transform: scale(1.1);
}
.inventory-item .count {
position: absolute;
top: 5px;
right: 5px;
background: var(--accent-color);
color: white;
width: 20px;
height: 20px;
border-radius: 50%;
font-size: 12px;
display: flex;
align-items: center;
justify-content: center;
}
.farm-area {
flex: 1;
background: white;
border-radius: 10px;
padding: 20px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
position: relative;
overflow: hidden;
}
.farm-grid {
display: grid;
grid-template-columns: repeat(8, 1fr);
gap: 10px;
margin-bottom: 20px;
}
.farm-plot {
aspect-ratio: 1/1;
background: #EFEBE9;
border-radius: 8px;
position: relative;
overflow: hidden;
transition: all 0.3s ease;
cursor: pointer;
}
.farm-plot:hover {
transform: scale(1.03);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}
.farm-plot::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 50%);
z-index: 1;
}
.farm-plot.planted {
background: #D7CCC8;
}
.crop {
position: absolute;
width: 80%;
height: 80%;
top: 10%;
left: 10%;
z-index: 2;
transition: all 0.5s ease;
}
.crop img {
width: 100%;
height: 100%;
object-fit: contain;
}
.progress-bar {
position: absolute;
bottom: 5px;
left: 10%;
width: 80%;
height: 5px;
background: #E0E0E0;
border-radius: 5px;
overflow: hidden;
z-index: 3;
}
.progress {
height: 100%;
background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
width: 0%;
transition: width 0.5s ease;
}
.action-buttons {
display: flex;
gap: 10px;
margin-top: 20px;
}
.btn {
padding: 10px 20px;
border: none;
border-radius: 5px;
font-weight: bold;
cursor: pointer;
transition: all 0.3s ease;
display: flex;
align-items: center;
gap: 8px;
}
.btn-primary {
background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
color: white;
}
.btn-primary:hover {
transform: translateY(-2px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.1);
}
.btn-secondary {
background: white;
border: 1px solid #E0E0E0;
color: #757575;
}
.btn-secondary:hover {
background: #F5F5F5;
}
.floating-notification {
position: fixed;
top: 20px;
right: 20px;
background: white;
padding: 15px 20px;
border-radius: 8px;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
display: flex;
align-items: center;
gap: 10px;
transform: translateX(150%);
transition: transform 0.5s ease;
z-index: 1000;
}
.floating-notification.show {
transform: translateX(0);
}
.floating-notification i {
font-size: 24px;
color: var(--primary-color);
}
.floating-notification.success i {
color: var