Spaces:
Running
Running
Thêm hiệu ứng 3d
Browse files- components/3d-card.js +53 -0
- index.html +12 -5
- script.js +17 -3
- style.css +44 -2
components/3d-card.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
class ThreeDCard extends HTMLElement {
|
| 2 |
+
connectedCallback() {
|
| 3 |
+
this.attachShadow({ mode: 'open' });
|
| 4 |
+
this.shadowRoot.innerHTML = `
|
| 5 |
+
<style>
|
| 6 |
+
:host {
|
| 7 |
+
display: block;
|
| 8 |
+
perspective: 1000px;
|
| 9 |
+
}
|
| 10 |
+
|
| 11 |
+
.card {
|
| 12 |
+
width: 100%;
|
| 13 |
+
height: 100%;
|
| 14 |
+
position: relative;
|
| 15 |
+
transform-style: preserve-3d;
|
| 16 |
+
transition: transform 0.8s;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
:host(:hover) .card {
|
| 20 |
+
transform: rotateY(15deg);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
.card-front, .card-back {
|
| 24 |
+
position: absolute;
|
| 25 |
+
width: 100%;
|
| 26 |
+
height: 100%;
|
| 27 |
+
backface-visibility: hidden;
|
| 28 |
+
border-radius: 1rem;
|
| 29 |
+
box-shadow: 0 10px 30px rgba(0,0,0,0.1);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.card-back {
|
| 33 |
+
transform: rotateY(180deg);
|
| 34 |
+
background: white;
|
| 35 |
+
display: flex;
|
| 36 |
+
align-items: center;
|
| 37 |
+
justify-content: center;
|
| 38 |
+
padding: 1rem;
|
| 39 |
+
}
|
| 40 |
+
</style>
|
| 41 |
+
<div class="card">
|
| 42 |
+
<div class="card-front">
|
| 43 |
+
<slot name="front"></slot>
|
| 44 |
+
</div>
|
| 45 |
+
<div class="card-back">
|
| 46 |
+
<slot name="back"></slot>
|
| 47 |
+
</div>
|
| 48 |
+
</div>
|
| 49 |
+
`;
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
customElements.define('3d-card', ThreeDCard);
|
index.html
CHANGED
|
@@ -16,8 +16,8 @@
|
|
| 16 |
|
| 17 |
<main>
|
| 18 |
<!-- Hero Section -->
|
| 19 |
-
<section class="relative h-screen flex items-center justify-center
|
| 20 |
-
|
| 21 |
<div class="relative z-10 text-center px-4">
|
| 22 |
<h1 class="text-5xl md:text-7xl font-serif text-white mb-6">Sarah & James</h1>
|
| 23 |
<p class="text-xl md:text-2xl text-white mb-8">June 15, 2024 • The Grand Ballroom</p>
|
|
@@ -195,17 +195,24 @@
|
|
| 195 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 196 |
<style>
|
| 197 |
/* Add subtle heartbeat to hero section */
|
| 198 |
-
section.
|
| 199 |
animation: heartbeat 1.5s ease-in-out infinite;
|
|
|
|
| 200 |
}
|
| 201 |
|
| 202 |
@keyframes heartbeat {
|
| 203 |
0% { transform: scale(1); }
|
| 204 |
-
25% { transform: scale(1.05); }
|
| 205 |
50% { transform: scale(1); }
|
| 206 |
-
75% { transform: scale(1.03); }
|
| 207 |
100% { transform: scale(1); }
|
| 208 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
</style>
|
| 210 |
</body>
|
| 211 |
</html>
|
|
|
|
| 16 |
|
| 17 |
<main>
|
| 18 |
<!-- Hero Section -->
|
| 19 |
+
<section class="hero-section relative h-screen flex items-center justify-center overflow-hidden">
|
| 20 |
+
<div class="absolute inset-0 bg-black bg-opacity-50"></div>
|
| 21 |
<div class="relative z-10 text-center px-4">
|
| 22 |
<h1 class="text-5xl md:text-7xl font-serif text-white mb-6">Sarah & James</h1>
|
| 23 |
<p class="text-xl md:text-2xl text-white mb-8">June 15, 2024 • The Grand Ballroom</p>
|
|
|
|
| 195 |
<script src="https://huggingface.co/deepsite/deepsite-badge.js"></script>
|
| 196 |
<style>
|
| 197 |
/* Add subtle heartbeat to hero section */
|
| 198 |
+
section.hero-section h1 {
|
| 199 |
animation: heartbeat 1.5s ease-in-out infinite;
|
| 200 |
+
transform-style: preserve-3d;
|
| 201 |
}
|
| 202 |
|
| 203 |
@keyframes heartbeat {
|
| 204 |
0% { transform: scale(1); }
|
| 205 |
+
25% { transform: scale(1.05) translateZ(10px); }
|
| 206 |
50% { transform: scale(1); }
|
| 207 |
+
75% { transform: scale(1.03) translateZ(5px); }
|
| 208 |
100% { transform: scale(1); }
|
| 209 |
}
|
| 210 |
+
|
| 211 |
+
/* 3D Depth for main content */
|
| 212 |
+
main {
|
| 213 |
+
transform-style: preserve-3d;
|
| 214 |
+
transition: transform 0.5s ease;
|
| 215 |
+
}
|
| 216 |
</style>
|
| 217 |
</body>
|
| 218 |
</html>
|
script.js
CHANGED
|
@@ -49,13 +49,27 @@ function addFloatingEffects() {
|
|
| 49 |
el.style.animation = 'pulse 2s ease-in-out infinite';
|
| 50 |
});
|
| 51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
|
| 53 |
// Intersection Observer for section animations
|
| 54 |
document.addEventListener('DOMContentLoaded', () => {
|
| 55 |
createHearts();
|
| 56 |
-
addFloatingEffects();
|
| 57 |
-
|
| 58 |
-
|
| 59 |
const observer = new IntersectionObserver((entries) => {
|
| 60 |
entries.forEach(entry => {
|
| 61 |
if (entry.isIntersecting) {
|
|
|
|
| 49 |
el.style.animation = 'pulse 2s ease-in-out infinite';
|
| 50 |
});
|
| 51 |
}
|
| 52 |
+
// Parallax and 3D Effects
|
| 53 |
+
function init3DEffects() {
|
| 54 |
+
// Mouse move parallax
|
| 55 |
+
document.addEventListener('mousemove', (e) => {
|
| 56 |
+
const xAxis = (window.innerWidth / 2 - e.pageX) / 25;
|
| 57 |
+
const yAxis = (window.innerHeight / 2 - e.pageY) / 25;
|
| 58 |
+
document.querySelector('main').style.transform = `rotateY(${xAxis}deg) rotateX(${yAxis}deg)`;
|
| 59 |
+
});
|
| 60 |
+
|
| 61 |
+
// Reset position when mouse leaves
|
| 62 |
+
document.querySelector('main').addEventListener('mouseleave', () => {
|
| 63 |
+
document.querySelector('main').style.transform = 'rotateY(0) rotateX(0)';
|
| 64 |
+
});
|
| 65 |
+
}
|
| 66 |
|
| 67 |
// Intersection Observer for section animations
|
| 68 |
document.addEventListener('DOMContentLoaded', () => {
|
| 69 |
createHearts();
|
| 70 |
+
addFloatingEffects();
|
| 71 |
+
init3DEffects();
|
| 72 |
+
const sections = document.querySelectorAll('section');
|
| 73 |
const observer = new IntersectionObserver((entries) => {
|
| 74 |
entries.forEach(entry => {
|
| 75 |
if (entry.isIntersecting) {
|
style.css
CHANGED
|
@@ -56,19 +56,61 @@ a, button, input[type="submit"], label {
|
|
| 56 |
::-webkit-scrollbar-thumb:hover {
|
| 57 |
background: #555;
|
| 58 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
/* Animation for sections */
|
| 61 |
section {
|
| 62 |
opacity: 0;
|
| 63 |
-
transform: translateY(20px);
|
| 64 |
transition: opacity 0.6s ease-out, transform 0.6s ease-out;
|
|
|
|
| 65 |
}
|
| 66 |
|
| 67 |
section.show {
|
| 68 |
opacity: 1;
|
| 69 |
-
transform: translateY(0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 70 |
}
|
| 71 |
|
|
|
|
|
|
|
|
|
|
| 72 |
/* Custom hover effect for gallery images */
|
| 73 |
.gallery-item {
|
| 74 |
overflow: hidden;
|
|
|
|
| 56 |
::-webkit-scrollbar-thumb:hover {
|
| 57 |
background: #555;
|
| 58 |
}
|
| 59 |
+
/* 3D Perspective for the page */
|
| 60 |
+
body {
|
| 61 |
+
perspective: 1000px;
|
| 62 |
+
overflow-x: hidden;
|
| 63 |
+
}
|
| 64 |
|
| 65 |
/* Animation for sections */
|
| 66 |
section {
|
| 67 |
opacity: 0;
|
| 68 |
+
transform: translateY(20px) rotateX(5deg);
|
| 69 |
transition: opacity 0.6s ease-out, transform 0.6s ease-out;
|
| 70 |
+
transform-style: preserve-3d;
|
| 71 |
}
|
| 72 |
|
| 73 |
section.show {
|
| 74 |
opacity: 1;
|
| 75 |
+
transform: translateY(0) rotateX(0);
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
/* 3D Card Effect for Wedding Details */
|
| 79 |
+
#details .grid > div {
|
| 80 |
+
transform: translateZ(20px);
|
| 81 |
+
transition: transform 0.5s ease;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
#details .grid > div:hover {
|
| 85 |
+
transform: translateZ(30px) rotateY(5deg);
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/* Parallax Effect for Hero */
|
| 89 |
+
.hero-section {
|
| 90 |
+
transform-style: preserve-3d;
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
.hero-section::before {
|
| 94 |
+
content: '';
|
| 95 |
+
position: absolute;
|
| 96 |
+
top: 0;
|
| 97 |
+
right: 0;
|
| 98 |
+
bottom: 0;
|
| 99 |
+
left: 0;
|
| 100 |
+
background: url('https://static.photos/nature/1200x630/42') center/cover no-repeat fixed;
|
| 101 |
+
transform: translateZ(-1px) scale(1.02);
|
| 102 |
+
z-index: -1;
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
/* 3D Gallery */
|
| 106 |
+
#gallery .aspect-square {
|
| 107 |
+
transform-style: preserve-3d;
|
| 108 |
+
transition: transform 0.5s ease;
|
| 109 |
}
|
| 110 |
|
| 111 |
+
#gallery .aspect-square:hover {
|
| 112 |
+
transform: rotateY(15deg) translateZ(20px);
|
| 113 |
+
}
|
| 114 |
/* Custom hover effect for gallery images */
|
| 115 |
.gallery-item {
|
| 116 |
overflow: hidden;
|