three+gsap实现3d三维拼图游戏代码
代码语言:html
所属分类:游戏
代码描述:three+gsap实现3d三维拼图游戏代码
代码标签: three gsap 3d 三维 拼图 游戏 代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<style>
@import url(https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap);
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: #fff0;
touch-action: manipulation
}
body {
font-family: "Inter", sans-serif;
font-optical-sizing: auto;
font-weight: 600;
font-style: normal;
overflow: hidden;
background: #1a1a1a;
-webkit-text-size-adjust: none;
text-size-adjust: none;
touch-action: none;
height: 100vh
}
#container {
position: relative;
width: 100vw;
height: 100vh;
touch-action: none
}
#ui {
position: absolute;
top: 20px;
left: 20px;
z-index: 200;
background: rgb(30 30 30 / .95);
padding: 15px;
border-radius: 8px;
box-shadow: 0 2px 10px rgb(0 0 0 / .3);
max-width: 280px;
color: #fff;
border: 1px solid rgb(255 255 255 / .1);
transition: transform 0.3s ease
}
#ui.collapsed {
transform: translateX(-186px)
}
#toggleUI {
position: absolute;
right: -40px;
top: 50%;
transform: translateY(-50%);
background: #2a2a2a;
border: 1px solid rgb(255 255 255 / .1);
color: #fff;
width: 40px;
height: 40px;
border-radius: 0 8px 8px 0;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
z-index: 101
}
h1 {
color: #fff;
margin-bottom: 15px;
font-size: 20px
}
.controls {
display: flex;
flex-direction: column;
gap: 12px
}
button {
background: #2a2a2a;
color: #fff;
border: 1px solid rgb(255 255 255 / .1);
padding: 10px 15px;
border-radius: 6px;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: all 0.2s ease;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
touch-action: manipulation
}
button:hover {
background: #3a3a3a
}
select {
padding: 8px;
border: 1px solid rgb(255 255 255 / .1);
border-radius: 6px;
font-size: 14px;
background: #2a2a2a;
color: #fff;
width: 100%;
touch-action: manipulation
}
#message {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background: rgb(30 30 30 / .95);
color: #fff;
padding: 20px 40px;
border-radius: 8px;
font-weight: 500;
opacity: 0;
transition: opacity 0.3s;
z-index: 100;
border: 1px solid rgb(255 255 255 / .1);
pointer-events: none
}
#message.show {
opacity: 1
}
#preview {
position: absolute;
top: 20px;
right: 20px;
width: 120px;
height: 120px;
background: rgb(0 0 0 / .7);
border-radius: 6px;
overflow: hidden;
border: 1px solid rgb(255 255 255 / .1);
z-index: 100
}
#preview img {
width: 100%;
height: 100%;
object-fit: cover
}
canvas {
display: block;
outline: none;
touch-action: none
}
#hint {
position: fixed;
bottom: 20px;
left: 20px;
background: rgb(30 30 30 / .9);
padding: 8px 12px;
border-radius: 6px;
color: #fff;
font-size: 12px;
max-width: 280px;
border: 1px solid rgb(255 255 255 / .1)
}
@media (max-width:600px) {
#hint {
max-width: 90%
}
}
.mode-selector {
display: flex;
gap: 8px;
margin-top: 8px
}
.mode-btn {
flex: 1;
padding: 6px;
font-size: 12px;
background: #2a2a2a
}
.mode-btn.active {
background: #4a9eff
}
.image-credit {
font-size: 11px;
color: #666;
margin-top: 10px;
text-align: center
}
.language-selector {
margin-top: 10px;
position: relative
}
.language-btn {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
padding: 8px 15px
}
.language-btn img {
width: 20px;
height: 15px;
object-fit: cover;
border-radius: 2px
}
.language-dropdown {
position: absolute;
background: rgb(40 40 40 / .98);
backdrop-filter: b.........完整代码请登录后点击上方下载按钮下载查看
















网友评论0