js实现一个打桌球游戏代码

代码语言:html

所属分类:游戏

代码描述:js实现一个打桌球游戏代码,点击白球按住鼠标不放,选择力度,松开鼠标推球。

代码标签: js 桌球 游戏

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

<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  


  <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Major+Mono+Display&amp;display=swap'>
  
<style>
* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-image: url("//repo.bfw.wiki/bfwrepo/image/62745d1f454cd.png");
  background-size: 350px;
  overflow: hidden;
}

.title {
  user-select: none;
  position: absolute;
  z-index: 20;
  font-family: "Major Mono Display", monospace;
  color: white;
  top: 16px;
  right: 16px;
  font-size: 28px;
  text-align: right;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  word-spacing: -5px;
  letter-spacing: -1px;
  padding-bottom: 15px;
  text-shadow: 4px 4px 2px rgba(0, 0, 0, 0.5);
}
.title small {
  font-size: 14px;
  position: absolute;
  top: 120%;
  right: 0;
}
.title::before {
  content: "";
  position: absolute;
  bottom: 0;
  opacity: 0.25;
  right: 0px;
  height: 3px;
  width: 87px;
  background: white;
}

.controls {
  position: relative;
  margin-bottom: 10px;
}
.controls button {
  border: 1px solid white;
  background: none;
  appearance: none;
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  text-transform: uppercase;
  font-size: 11px;
  cursor: pointer;
}
.controls button:hover {
  background: white;
  color: #333;
}

.fade {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0), black);
}

.table {
  width: 540px;
  height: 310px;
  border-radius: 10px;
  background: #5b230d;
  position: relative;
  display: flex;
  padding: 20px;
  box-shadow: 0px 0px 15px 2px rgba(0, 0, 0, 0.5), inset 0px 0px 5px rgba(0, 0, 0, 0.5);
}
.table__pockets {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}
.table__pockets span {
  width: 25px;
  height: 25px;
  border-radius: 100%;
  background: black;
  position: absolute;
  background: linear-gradient(0deg, black, #111);
  box-shadow: inset 0 3px black, 0px 0px 5px rgba(0, 0, 0, 0.5);
  b.........完整代码请登录后点击上方下载按钮下载查看

网友评论0