鱼生鱼小游戏

代码语言:html

所属分类:游戏

代码描述:鱼生鱼小游戏,点击鱼生成新的鱼

代码标签:

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
body {
  background-image: linear-gradient(#339, #09f 85%, #339);
  height: 100vh;
  margin: 0;
}

.instructions {
  bottom: 3vh;
  color: #09f;
  font-family: sans-serif;
  font-size: 5vmin;
  left: 0;
  position: fixed;
  right: 0;
  text-align: center;
}

.counter {
  color: #f90;
  font-family: sans-serif;
  font-size: 5vmin;
  position: fixed;
  right: 3vmin;
  top: 3vmin;
}

.fish {
  background-color: #f90;
  background-image: linear-gradient(90deg, #f90, #f60, #f90);
  border-radius: 50% 50% 0 0;
  color: #c00;
  font-size: 3vmin;
  height: 3vmin;
  left: calc(50% - 1.5vmin);
  position: fixed;
  text-align: center;
  top: -5%;
  transition: left, top ease-in-out;
  user-select: none;
  width: 3vmin;
}
.fish:before {
  background-color: #000;
  border: solid 1px #fff;
  border-radius: 50%;
  bottom: 60%;
  content: "";
  left: 30%;
  position: absolute;
  right: 30%;
  top: 5%;
}
.fish:after {
  border: solid 1.5vmin transparent;
  border-bottom-color: #f60;
  bottom: -40%;
  content: "";
  height: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: 40%;
  width: 0;
}
.fish:hover {
  background-color: #fff;
  background-image: none;
  cursor: pointer;
}
.fish:hover:after {
  border-bottom-color: #fff;
}
</style>

</head>
<body translate="no">
<div class="instructions">点击鱼生成新的鱼</div>
<div class="counter">1</div>

<script >
const speed = 5,
fish = document.querySelector('.fish'),
counter = document.querySelector('.counter');

let count = 0,
vw = window.innerWidth * .97,
vh = window.innerHeight * .97;

function getAn.........完整代码请登录后点击上方下载按钮下载查看

网友评论0