js+svg实现跳跃小游戏代码
代码语言:html
所属分类:游戏
代码描述:js+svg实现跳跃小游戏代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Oi&display=swap" rel="stylesheet">
<style>
body {
overflow: hidden;
font-family: sans-serif;
background: slateblue;
background-image: linear-gradient(slateblue 25%, rgb(255 255 255 / 0)),
url("data:image/svg+xml,%3Csvg width='12' height='16' viewBox='0 0 12 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 .99C4 .445 4.444 0 5 0c.552 0 1 .45 1 .99v4.02C6 5.555 5.556 6 5 6c-.552 0-1-.45-1-.99V.99zm6 8c0-.546.444-.99 1-.99.552 0 1 .45 1 .99v4.02c0 .546-.444.99-1 .99-.552 0-1-.45-1-.99V8.99z' fill='navy' fill-opacity='0.1' fill-rule='evenodd'/%3E%3C/svg%3E");
-webkit-animation: rain 40s linear infinite;
animation: rain 40s linear infinite;
}
@-webkit-keyframes rain {
from {
background-position-y: 0%;
}
to {
background-position-y: 100%;
}
}
@keyframes rain {
from {
background-position-y: 0%;
}
to {
background-position-y: 100%;
}
}
#stage {
display: grid;
place-content: end center;
min-height: 100vh;
transform-origin: bottom center;
}
#figure {
position: relative;
width: 100px;
aspect-ratio: 1;
perspective: 1000px;
}
#figure .inner {
position: relative;
width: 100%;
height: 100%;
transform-style: preserve-3d;
}
#figure .back,
#figure .front {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border-radius: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
.........完整代码请登录后点击上方下载按钮下载查看
网友评论0