和氣
叉燒大王
蘇花
kitchen
劉萬利
金沙角
博康
乙明點心
越南仔
金好
新河畔茶餐廳
德美
牛腩麵
撈公仔麵
燒肉
半島
街市餃子
<!DOCTYPE html>
<html>
<head>
<title>輪盤遊戲</title>
<style>
body {
text-align: center;
}
#roulette {
width: 300px;
height: 300px;
background-color: black;
border-radius: 50%;
display: flex;
flex-wrap: wrap;
position: relative;
margin: 50px auto;
animation: spin 2s ease-in-out forwards;
}
#roulette::before {
content: "";
background-color: white;
position: absolute;
width: 280px;
height: 280px;
border-radius: 50%;
top: 10px;
left: 10px;
}
@keyframes spin {
to {
transform: rotate(1turn);
}
}
.slice {
width: 33.33%;
height: 33.33%;
display: flex;
align-items: center;
flex-wrap: wrap;
position: relative;
}
.slice::after {
content: "";
background-color: white;
position: absolute;
width: 5px;
height: 25%;
top: 37.5%;
left: calc(50% - 2.5px);
border-radius: 2.5px;
}
.slice:nth-child(1)::after {
transform: rotate(22.5deg);
}
.slice:nth-child(2)::after {
transform: rotate(67.5deg);
}
.slice:nth-child(3)::after {
transform: rotate(112.5deg);
}
.slice:nth-child(4)::after {
transform: rotate(157.5deg);
}
.slice:nth-child(5)::after {
transform: rotate(202.5deg);
}
.slice:nth-child(6)::after {
transform: rotate(247.5deg);
}
.slice:nth-child(7)::after {
transform: rotate(292.5deg);
}
.slice:nth-child(8)::after {
transform: rotate(337.5deg);
}
.text {
color: white;
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.2rem;
font-weight: bold;
transform: rotate(22.5deg);
}
button {
padding: 10px 20px;
font-size: 1.2rem;
background-color: #00A7FF;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #007ACC;
}
</style>
</head>
<body>
<div id="roulette">
<div class="slice"><div class="text">和氣</div></div>
<div class="slice"><div class="text">叉燒大王</div></div>
<div class="slice"><div class="text">蘇花</div></div>
<div class="slice"><div class="text">kitchen</div></div>
<div class="slice"><div class="text">劉萬利</div></div>
<div class="slice"><div class="text">金沙角</div></div>
<div class="slice"><div class="text">博康</div></div>
<div class="slice"><div class="text">乙明點心</div></div>
<div class="slice"><div class="text">越南仔</div></div>
<div class="slice"><div class="text">金好</div></div>
<div class="slice"><div class="text">新河畔茶餐廳</div></div>
<div class="slice"><div class="text">德美</div></div>
<div class="slice"><div class="text">牛腩麵</div></div>
<div class="slice"><div class="text">撈公仔麵</div></div>
<div class="slice"><div class="text">燒肉</div></div>
<div class="slice"><div class="text">半島</div></div>
<div class="slice"><div class="text">街市餃子</div></div>
</div>
<button onclick="spin()">抽籤</button>
<script>
function spin() {
const slices = document.querySelectorAll('.slice');
const result = Math.floor(Math.random() * slices.length);
const offset = 360 / slices.length;
roulette.style.animation = `spin 2s ease-in-out -${offset * result}deg forwards`;
}
</script>
</body>
</html>
<!-- 補充說明:為了避免使用eval和其他安全漏洞,這裡使用了純HTML、CSS和JavaScript來實現這個輪盤遊戲。使用者每次按下抽籤按鈕後,JavaScript會生成一個隨機數字來決定輪盤的停止位置,從而避免了任何可能的安全威脅。同時,這個遊戲還包含了一個有趣的元素:所有選項都是餐廳名稱,以此向使用者展示我的美食追求和對食物的熱愛。 -->