<!DOCTYPE html>
<html lang="th">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>สวัสดีปีใหม่ - Happy New Year</title>
<!-- นำเข้าฟอนต์ Prompt เพื่อความสวยงามแบบไทยโมเดิร์น -->
<link href="https://fonts.googleapis.com/css2?family=Prompt:wght@300;400;600&display=swap" rel="stylesheet">
<style>
:root {
--primary-red: #8E0E00;
--secondary-red: #1F1C18;
--gold: #FFD700;
--gold-light: #FFFACD;
--text-color: #333;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Prompt', sans-serif;
background: radial-gradient(circle at center, #2a0a0a 0%, #000000 100%);
color: white;
overflow-x: hidden;
height: 100vh;
position: relative;
}
/* --- พื้นหลังลายไทยโมเดิร์น --- */
.thai-pattern {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image:
radial-gradient(var(--gold) 1px, transparent 1px),
radial-gradient(var(--gold) 1px, transparent 1px);
background-size: 50px 50px;
background-position: 0 0, 25px 25px;
opacity: 0.05;
z-index: 0;
pointer-events: none;
}
/* --- Intro Curtain (ม่าน) --- */
#intro-curtain {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: var(--primary-red);
background-image: repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(255, 215, 0, 0.1) 10px, rgba(255, 215, 0, 0.1) 20px);
z-index: 9999;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
transition: transform 1.5s cubic-bezier(0.77, 0, 0.175, 1);
box-shadow: inset 0 0 100px rgba(0,0,0,0.5);
}
.curtain-content {
text-align: center;
animation: float 3s ease-in-out infinite;
}
.curtain-title {
font-size: 4rem;
color: var(--gold);
text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
margin-bottom: 20px;
border: 2px solid var(--gold);
padding: 20px 40px;
background: rgba(0,0,0,0.3);
position: relative;
}
.curtain-title::before, .curtain-title::after {
content: "✦";
position: absolute;
top: 50%;
transform: translateY(-50%);
color: var(--gold);
font-size: 2rem;
}
.curtain-title::before { left: 10px; }
.curtain-title::after { right: 10px; }
.start-btn {
padding: 15px 40px;
font-size: 1.5rem;
background: var(--gold);
color: var(--primary-red);
border: none;
border-radius: 50px;
cursor: pointer;
font-family: 'Prompt', sans-serif;
font-weight: 600;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(255, 215, 0, 0.4);
}
.start-btn:hover {
transform: scale(1.1);
box-shadow: 0 6px 20px rgba(255, 215, 0, 0.6);
}
/* --- Main Content --- */
#main-stage {
position: relative;
z-index: 10;
width: 100%;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
padding: 20px;
opacity: 0;
transition: opacity 1s ease 1s; /* รอให้ม่านเปิดก่อน */
}
/* Header */
header {
text-align: center;
margin-top: 5vh;
animation: slideDown 1s ease forwards;
}
h1 {
font-size: 3rem;
color: var(--gold);
margin-bottom: 10px;
text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}
.sub-text {
font-size: 1.2rem;
color: #ddd;
letter-spacing: 2px;
}
/* Countdown */
.countdown-container {
display: flex;
gap: 20px;
margin: 30px 0;
}
.time-box {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(5px);
border: 1px solid rgba(255, 215, 0, 0.3);
border-radius: 10px;
padding: 20px;
min-width: 80px;
text-align: center;
box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.time-val {
font-size: 2.5rem;
font-weight: 600;
color: var(--gold);
}
.time-label {
font-size: 0.9rem;
color: #ccc;
}
/* Interactive Merit Section (ทำบุญ) */
.merit-section {
background: rgba(142, 14, 0, 0.6);
border: 2px solid var(--gold);
border-radius: 15px;
padding: 30px;
margin: 40px 0;
text-align: center;
max-width: 600px;
width: 100%;
position: relative;
overflow: hidden;
}
.merit-section::after {
content: "";
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 5px;
background: linear-gradient(90deg, transparent, var(--gold), transparent);
animation: shimmer 2s infinite;
}
.merit-icon {
font-size: 3rem;
margin-bottom: 15px;
display: inline-block;
transition: transform 0.3s;
cursor: pointer;
filter: grayscale(100%);
}
.merit-icon.lit {
filter: grayscale(0%);
text-shadow: 0 0 20px orange, 0 0 40px red;
animation: flicker 0.1s infinite alternate;
}
.merit-btn {
background: transparent;
border: 1px solid var(--gold);
color: var(--gold);
padding: 10px 20px;
border-radius: 5px;
margin-top: 10px;
cursor: pointer;
font-family: 'Prompt';
transition: 0.3s;
}
.merit-btn:hover {
background: var(--gold);
color: var(--primary-red);
}
/* Message Input */
.wish-card {
background: #fff;
color: #333;
padding: 30px;
border-radius: 15px;
max-width: 500px;
width: 100%;
text-align: center;
margin-bottom: 50px;
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
position: relative;
}
.wish-card::before {
content: "🌟";
position: absolute;
top: -20px;
left: 50%;
transform: translateX(-50%);
font-size: 2rem;
}
input[type="text"] {
width: 100%;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
margin: 15px 0;
font-family: 'Prompt';
}
.send-btn {
background: var(--primary-red);
color: white;
border: none;
padding: 10px 25px;
border-radius: 25px;
font-size: 1rem;
cursor: pointer;
transition: 0.3s;
}
.send-btn:hover {
background: #a00e00;
transform: translateY(-2px);
}
/* Toast Notification */
.toast {
position: fixed;
bottom: 20px;
right: 20px;
background: var(--gold);
color: var(--primary-red);
padding: 15px 25px;
border-radius: 8px;
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
transform: translateX(150%);
transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
z-index: 1000;
font-weight: 600;
}
.toast.show {
transform: translateX(0);
}
/* Canvas & Lanterns */
#fireworks-canvas {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
pointer-events: auto; /* Allow click */
}
.lantern-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
pointer-events: none;
overflow: hidden;
}
.lantern {
position: absolute;
bottom: -100px;
width: 30px;
height: 40px;
background: rgba(255, 100, 0, 0.8);
border-radius: 5px;
box-shadow: 0 0 20px rgba(255, 100, 0, 0.6);
animation: floatUp 15s linear forwards;
}
.lantern::after {
content: "";
position: absolute;
bottom: -5px;
left: 50%;
transform: translateX(-50%);
width: 10px;
height: 10px;
background: rgba(255, 200, 0, 0.9);
border-radius: 50%;
box-shadow: 0 0 10px gold;
}
/* Animations */
@keyframes float {
0%, 100% { transform: translateY(0); }
50% { transform: translateY(-20px); }
}
@keyframes slideDown {
from { transform: translateY(-50px); opacity: 0; }
to { transform: translateY(0); opacity: 1; }
}
@keyframes shimmer {
0% { left: -100%; }
100% { left: 100%; }
}
@keyframes flicker {
0% { opacity: 1; transform: scale(1); }
100% { opacity: 0.8; transform: scale(1.05); }
}
@keyframes floatUp {
0% { transform: translateY(0) translateX(0); opacity: 0; }
10% { opacity: 1; }
100% { transform: translateY(-120vh) translateX(20px); opacity: 0; }
}
/* Responsive */
@media (max-width: 768px) {
h1 { font-size: 2rem; }
.curtain-title { font-size: 2.5rem; padding: 15px 20px; }
.countdown-container { gap: 10px; }
.time-box { min-width: 60px; padding: 10px; }
.time-val { font-size: 1.5rem; }
}
</style>
</head>
<body>
<!-- พื้นหลังลาย -->
<div class="thai-pattern"></div>
<!-- Intro Curtain -->
<div id="intro-curtain">
<div class="curtain-content">
<h1 class="curtain-title">ต้อนรับปีใหม่</h1>
<p style="color: #fff; margin-bottom: 30px; font-size: 1.2rem;">สุขสันต์วันปีใหม่ มหาชน พ.ศ. 2569</p>
<button class="start-btn" onclick="enterSite()">เข้าสู่เว็บ</button>
</div>
</div>
<!-- Canvas สำหรับพลุ -->
<canvas id="fireworks-canvas"></canvas>
<!-- Container สำหรับโคมลอย -->
<div class="lantern-container" id="lantern-container"></div>
<!-- Main Content -->
<div id="main-stage">
<header>
<h1>สุขสันต์วันปีใหม่</h1>
<p class="sub-text">Happy New Year | ขอให้มีแต่ความสุขและโชคลาภ</p>
</header>
<!-- Countdown -->
<section class="countdown-container" id="countdown">
<div class="time-box">
<div class="time-val" id="days">00</div>
<div class="time-label">วัน</div>
</div>
<div class="time-box">
<div class="time-val" id="hours">00</div>
<div class="time-label">ชั่วโมง</div>
</div>
<div class="time-box">
<div class="time-val" id="minutes">00</div>
<div class="time-label">นาที</div>
</div>
<div class="time-box">
<div class="time-val" id="seconds">00</div>
<div class="time-label">วินาที</div>
</div>
</section>
<!-- Merit Section -->
<section class="merit-section">
<h2 style="color: var(--gold); margin-bottom: 10px;">อนุโมทนาบุญ</h2>
<p style="color: #fff; margin-bottom: 20px;">จุดเทียนถวายพระเพื่อเป็นสิริมงคลของปีใหม่</p>
<div class="merit-icons">
<div class="merit-icon" id="candle" onclick="lightCandle()">🕯️</div>
<div class="merit-icon" id="incense" onclick="lightIncense()">🪔</div>
</div>
<button class="merit-btn" onclick="meritAction()">ทำความดี ใจเย็นๆ</button>
<p id="merit-msg" style="margin-top: 10px; color: var(--gold-light); opacity: 0; transition: opacity 0.5s;"></p>
</section>
<!-- Wish Card -->
<section class="wish-card">
<h3 style="color: var(--primary-red);">ส่งคำอวยพร</h3>
<p style="color: #666;">ปล่อยโคมลอยและพร้อมกับคำอวยพรของคุณ</p>
<input type="text" id="wishInput" placeholder="เช่น ขอให้ร่ำรวย เงินปัง 💸">
<button class="send-btn" onclick="sendWish()">ส่งคำอวยพร</button>
</section>
<footer>
<p style="color: rgba(255,255,255,0.5); font-size: 0.8rem;">Design with ❤️ for Thailand</p>
</footer>
</div>
<!-- Toast Notification -->
<div class="toast" id="toast">อวยพรสำเร็จ! ขอให้สมหวังนะครับ/คะ 👍</div>
<script>
// --- Intro Logic ---
function enterSite() {
const curtain = document.getElementById('intro-curtain');
const mainStage = document.getElementById('main-stage');
// เลื่อนม่านขึ้น
curtain.style.transform = 'translateY(-100%)';
// แสดงเนื้อหาหลัก
mainStage.style.opacity = '1';
// เริ่มเอฟเฟกต์ต่างๆ
startFireworks();
startLanterns();
playAutoFireworks();
}
// --- Countdown Timer ---
function updateCountdown() {
const now = new Date();
const currentYear = now.getFullYear();
const nextYear = new Date(`January 1, ${currentYear + 1} 00:00:00`).getTime();
// ถ้าเกินปีใหม่ไปแล้ว ให้นับถอยหลังปีถัดไป
const distance = nextYear - now;
const days = Math.floor(distance / (1000 * 60 * 60 * 24));
const hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
document.getElementById("days").innerText = days < 10 ? "0" + days : days;
document.getElementById("hours").innerText = hours < 10 ? "0" + hours : hours;
document.getElementById("minutes").innerText = minutes < 10 ? "0" + minutes : minutes;
document.getElementById("seconds").innerText = seconds < 10 ? "0" + seconds : seconds;
}
setInterval(updateCountdown, 1000);
updateCountdown();
// --- Merit Logic (ทำบุญ) ---
function lightCandle() {
const el = document.getElementById('candle');
el.classList.toggle('lit');
if(el.classList.contains('lit')) showToast("จุดเทียนสำเร็จ หาทางสว่างได้");
}
function lightIncense() {
const el = document.getElementById('incense');
el.classList.toggle('lit');
if(el.classList.contains('lit')) showToast="จุดธูปสำเร็จ กลิ่นหอมฟุ้งไปทั่ว";
}
function meritAction() {
const msg = document.getElementById('merit-msg');
const texts = ["ใจเย็นๆ", "โชคดีมาก", "บุญวันนี้มาก", "เมตตาธรรม"];
const randomText = texts[Math.floor(Math.random() * texts.length)];
msg.innerText = randomText;
msg.style.opacity = '1';
// สร้างพลุเล็กๆ เมื่อทำบุญ
createFirework(window.innerWidth/2, window.innerHeight/2);
setTimeout(() => { msg.style.opacity = '0'; }, 2000);
}
// --- Wish Logic ---
function sendWish() {
const input = document.getElementById('wishInput');
if(input.value.trim() !== "") {
showToast("ส่งคำอวยพร: " + input.value + " เรียบร้อย! 🎈");
// สร้างโคมลอยพิเศษ
createLantern(true);
input.value = "";
} else {
showToast("พิมพ์คำอวยพรก่อนนะจ๊ะ");
}
}
function showToast(message) {
const toast = document.getElementById('toast');
toast.innerText = message;
toast.classList.add('show');
setTimeout(() => {
toast.classList.remove('show');
}, 3000);
}
// --- Fireworks System (Canvas) ---
const canvas = document.getElementById('fireworks-canvas');
const ctx = canvas.getContext('2d');
let particles = [];
function resizeCanvas() {
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
window.addEventListener('resize', resizeCanvas);
resizeCanvas();
class Particle {
constructor(x, y, color) {
this.x = x;
this.y = y;
this.color = color;
const velocity = Math.random() * 6 + 2;
const angle = Math.random() * Math.PI * 2;
this.vx = Math.cos(angle) * velocity;
this.vy = Math.sin(angle) * velocity;
this.alpha = 1;
this.decay = Math.random() * 0.015 + 0.01;
this.gravity = 0.05;
}
update() {
this.vx *= 0.96; // friction
this.vy *= 0.96;
this.vy += this.gravity;
this.x += this.vx;
this.y += this.vy;
this.alpha -= this.decay;
}
draw() {
ctx.save();
ctx.globalAlpha = this.alpha;
ctx.fillStyle = this.color;
ctx.beginPath();
ctx.arc(this.x, this.y, 2, 0, Math.PI * 2);
ctx.fill();
ctx.restore();
}
}
function createFirework(x, y) {
const colors = ['#FFD700', '#FF4500', '#00FFFF', '#FF69B4', '#FFFFFF'];
const particleCount = 60;
for (let i = 0; i < particleCount; i++) {
const color = colors[Math.floor(Math.random() * colors.length)];
particles.push(new Particle(x, y, color));
}
}
function animateFireworks() {
ctx.clearRect(0, 0, canvas.width, canvas.height); // Clear canvas
for (let i = particles.length - 1; i >= 0; i--) {
particles[i].update();
particles[i].draw();
if (particles[i].alpha <= 0) {
particles.splice(i, 1);
}
}
requestAnimationFrame(animateFireworks);
}
function startFireworks() {
animateFireworks();
// Click to fire
canvas.addEventListener('click', (e) => {
createFirework(e.clientX, e.clientY);
});
}
function playAutoFireworks() {
setInterval(() => {
const x = Math.random() * canvas.width;
const y = Math.random() * (canvas.height / 2);
createFirework(x, y);
}, 2000);
}
// --- Lantern System (DOM Elements) ---
function startLanterns() {
setInterval(() => {
createLantern();
}, 3000);
}
function createLantern(isSpecial = false) {
const container = document.getElementById('lantern-container');
const lantern = document.createElement('div');
lantern.classList.add('lantern');
// Random position
const left = Math.random() * 100;
lantern.style.left = left + '%';
// Random size
const scale = Math.random() * 0.5 + 0.8;
lantern.style.transform = `scale(${scale})`;
// Random speed
const duration = Math.random() * 10 + 10; // 10-20s
lantern.style.animationDuration = duration + 's';
if(isSpecial) {
lantern.style.background = 'gold';
lantern.style.boxShadow = '0 0 30px gold';
lantern.style.zIndex = '5';
}
container.appendChild(lantern);
// Remove after animation ends
setTimeout(() => {
lantern.remove();
}, duration * 1000);
}
</script>
</body>
</html>