three实现三维扔骰子得点数游戏代码
代码语言:html
所属分类:游戏
代码描述:three实现三维扔骰子得点数游戏代码
代码标签: three 三维 扔 骰子 得 点数 游戏 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<link rel="canonical" href="https://codepen.io/ksenia-k/pen/QWZVvxm" />
<style>
.container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100vh;
flex: 1;
color: #444444;
display: flex;
justify-content: center;
align-items: center;
font-family: sans-serif;
}
canvas {
position: absolute;
top: 0;
left: 0;
}
.ui-controls {
position: relative;
width: 100%;
max-width: 500px;
user-select: none;
line-height: 1.5;
padding: 10px;
margin-top: -5%;
}
.ui-controls .score {
margin-left: .25em;
}
.ui-controls #score-result {
display: inline-block;
min-width: 1.8em;
}
.ui-controls #roll-btn {
background-color: #4BC0C8;
font-weight: bold;
border: none;
padding: .5em 1em;
text-decoration: none;
display: inline-block;
cursor: pointer;
margin: 1em 0 0 0;
transition: background-color 0.2s, transform 0.1s;
}
.ui-controls #roll-btn:active {
transform: translateY(4px);
}
</style>
</head>
<body >
<div class="container">
<canvas id="canvas"></canvas>
<div class="ui-controls">
<div class="score">Score: <span id="score-result"></span></div>
<button id="roll-btn">throw the dice</button>
</div>
</div>
<script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/es-module-shims.1.6.2.js"></script>
<script type="importmap">
{
"imports": {
"three": "//repo.bfw.wiki/bfwrepo/js/module/three/build/151/three.module.js",
"three/addons/": "//repo.bfw.wiki/bfwrepo/js/module/three/examples/151/jsm/"
}
}
</script>
<script type="module">
impo.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0