js实现徒手接吐司面包小游戏代码

代码语言:html

所属分类:游戏

代码描述:js实现徒手接吐司面包小游戏代码,吐司面包飞出来,要点击接住,否则就掉下去了。

代码标签: js 徒手 吐司 面包 游戏 代码

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

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

<head>
  <meta charset="UTF-8">
  
  
  
  
<style>
:root {
  background-color: #7DC8CF;
  font-family: system-ui;
  font-variant-numeric: tabular-nums;
}

*,
:after,
:before {
  box-sizing: border-box;
}

svg {
  display: block;
  font-size: 1.5rem;
  font-weight: 900;
  max-width: 100%;
  height: auto;
  max-height: 100%;
}

body {
  height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background: lightblue;
}

.frame {
  border: 6px solid #67442b;
  border-radius: 16px;
  background: #67442b;
}

#game {
  border-radius: 10px;
  user-select: none;
}

.toast {
  cursor: pointer;
}
.toast__wings {
  animation: wings-flapping linear infinite 0.4s;
  transform-origin: center 85%;
  pointer-events: none;
}
.toast__eyes {
  animation: blink linear infinite 2s;
  transform-origin: 15px;
}

@keyframes wings-flapping {
  0%, 100% {
    scale: 1 1;
  }
  50% {
    scale: 1 0.8;
  }
}
@keyframes blink {
  0%, 90% {
    scale: 1 1;
  }
  100% {
    scale: 1 0;
  }
}
</style>


  
  
</head>

<body translate="no">
  <div class="frame">
	<svg id="game" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="450" height="680" fill="none" viewBox="0 0 450 680">
		<path fill="#7DC8CF" d="M0 1h450v680H0z"/>
		<path fill="#976F4A" d="M0 0h450v80H0z"/>
		<path fill="#FDC571" d="M0 631h450v50H0z"/>
		<path fill="#67442B" d="M0 74h450v6H0z"/>
		<rect width="430" height="54" x="10" y="10" fill="#67442B" rx="12"/>
		<path xmlns="http://www.w3.org/2000/svg" fill="#FFE2B4" d="M391.652 25.303c3.524-3.523 9.148-3.665 12.842-.427l.017-.016.352-.334a9.407 9.407 0 0 1 13.285 13.286l-.333.352-13.303 13.303-13.304-13.304.016-.017c-3.238-3.695-3.097-9.318.428-12.843Z"/>
		<g fill="#FEDAA1" font="inherit" >
			<text id="score" x="25" y="46" >00000000</text>
			<text id="lives" x="345&quo.........完整代码请登录后点击上方下载按钮下载查看

网友评论0