原生js+css实现鼠标抓住移动闪烁的小点游戏代码
代码语言:html
所属分类:游戏
代码描述:原生js+css实现鼠标抓住移动闪烁的小点游戏代码
代码标签: 原生 js css 鼠标 抓住 移动 闪烁 小点 游戏 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
user-select: none;
}
:root {
--primary-color: #f0d6e8;
--secondary-color: #c1e8f8;
--accent-color: #a5b9ea;
--dark-accent: #9985c9;
--warning-color: #ff96ad;
--success-color: #96ffbc;
--background-dark: #2a2e45;
--background-light: #3d4263;
--text-color: #e0e5ff;
--health-good: #96ffbc;
--health-mid: #fff596;
--health-low: #ff96ad;
}
body, html {
width: 100%;
height: 100%;
overflow: hidden;
font-family: 'Cyberpunk', sans-serif;
background-color: var(--background-dark);
cursor: none;
}
.game-container {
position: relative;
width: 100%;
height: 100%;
background: linear-gradient(135deg, var(--background-dark), var(--background-light));
overflow: hidden;
}
.game-container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
linear-gradient(90deg, rgba(26, 29, 48, 0.3) 1px, transparent 1px),
linear-gradient(rgba(26, 29, 48, 0.3) 1px, transparent 1px),
linear-gradient(0deg, rgba(90, 100, 150, 0.1) 1px, transparent 1px),
background-size:
50px 50px,
50px 50px,
50px 50px,
200px 200px;
opacity: 0.6;
z-index: 0;
animation: backgroundPulse 10s infinite alternate;
}
@keyframes backgroundPulse {
0% {
background-position:
0 0,
0 0,
0 0,
0 0;
}
100% {
background-position:
20px 0,
0 20px,
-20px 0,
40px 40px;
}
}
.game-container::after {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image:
radial-gradient(circle at 50% 50%, var(--secondary-color) 0%, transparent 8%),
linear-gradient(90deg, transparent 95%, var(--accent-color) 95%),
linear-gradient(0deg, transparent 95%, var(--accent-color) 95%);
background-size: 300px 300px, 100px 100px, 100px 100px;
z-index: 0;
opa.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0