Spaces:
Running
Running
Hiệu ứng 3d cho ảnh thôi.
Browse files
script.js
CHANGED
|
@@ -49,21 +49,29 @@ function addFloatingEffects() {
|
|
| 49 |
el.style.animation = 'pulse 2s ease-in-out infinite';
|
| 50 |
});
|
| 51 |
}
|
| 52 |
-
//
|
| 53 |
function init3DEffects() {
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
});
|
| 65 |
}
|
| 66 |
-
|
| 67 |
// Intersection Observer for section animations
|
| 68 |
document.addEventListener('DOMContentLoaded', () => {
|
| 69 |
createHearts();
|
|
|
|
| 49 |
el.style.animation = 'pulse 2s ease-in-out infinite';
|
| 50 |
});
|
| 51 |
}
|
| 52 |
+
// Enhanced 3D Effects for Images
|
| 53 |
function init3DEffects() {
|
| 54 |
+
const images = document.querySelectorAll('img');
|
| 55 |
+
|
| 56 |
+
images.forEach(img => {
|
| 57 |
+
img.addEventListener('mousemove', (e) => {
|
| 58 |
+
const rect = img.getBoundingClientRect();
|
| 59 |
+
const x = e.clientX - rect.left;
|
| 60 |
+
const y = e.clientY - rect.top;
|
| 61 |
+
const centerX = rect.width / 2;
|
| 62 |
+
const centerY = rect.height / 2;
|
| 63 |
+
|
| 64 |
+
const rotateX = ((centerY - y) / centerY) * 10;
|
| 65 |
+
const rotateY = ((x - centerX) / centerX) * 10;
|
| 66 |
+
|
| 67 |
+
img.style.transform = `rotateX(${rotateX}deg) rotateY(${rotateY}deg) translateZ(20px)`;
|
| 68 |
+
});
|
| 69 |
|
| 70 |
+
img.addEventListener('mouseleave', () => {
|
| 71 |
+
img.style.transform = 'rotateX(0) rotateY(0) translateZ(0)';
|
| 72 |
+
});
|
| 73 |
});
|
| 74 |
}
|
|
|
|
| 75 |
// Intersection Observer for section animations
|
| 76 |
document.addEventListener('DOMContentLoaded', () => {
|
| 77 |
createHearts();
|
style.css
CHANGED
|
@@ -101,36 +101,36 @@ section.show {
|
|
| 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(
|
| 113 |
}
|
| 114 |
-
|
| 115 |
-
.
|
| 116 |
-
|
| 117 |
-
|
|
|
|
| 118 |
}
|
| 119 |
|
| 120 |
-
.
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
opacity: 0;
|
| 129 |
-
transition: opacity 0.3s ease;
|
| 130 |
}
|
| 131 |
|
| 132 |
-
|
| 133 |
-
|
|
|
|
| 134 |
}
|
| 135 |
/* QR Code section */
|
| 136 |
#gift {
|
|
|
|
| 101 |
transform: translateZ(-1px) scale(1.02);
|
| 102 |
z-index: -1;
|
| 103 |
}
|
|
|
|
| 104 |
/* 3D Gallery */
|
| 105 |
#gallery .aspect-square {
|
| 106 |
transform-style: preserve-3d;
|
| 107 |
transition: transform 0.5s ease;
|
| 108 |
+
position: relative;
|
| 109 |
}
|
| 110 |
|
| 111 |
#gallery .aspect-square:hover {
|
| 112 |
+
transform: rotateY(15deg) rotateX(10deg) translateZ(30px);
|
| 113 |
}
|
| 114 |
+
|
| 115 |
+
#gallery .aspect-square img {
|
| 116 |
+
transform-style: preserve-3d;
|
| 117 |
+
transition: transform 0.5s ease, box-shadow 0.5s ease;
|
| 118 |
+
box-shadow: 0 10px 20px rgba(0,0,0,0.1);
|
| 119 |
}
|
| 120 |
|
| 121 |
+
#gallery .aspect-square:hover img {
|
| 122 |
+
transform: translateZ(20px);
|
| 123 |
+
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
|
| 124 |
+
}
|
| 125 |
+
/* Enhanced 3D Effect for Images */
|
| 126 |
+
img {
|
| 127 |
+
transition: transform 0.5s ease, filter 0.5s ease;
|
| 128 |
+
transform-style: preserve-3d;
|
|
|
|
|
|
|
| 129 |
}
|
| 130 |
|
| 131 |
+
img:hover {
|
| 132 |
+
transform: rotateY(10deg) rotateX(5deg) translateZ(10px);
|
| 133 |
+
filter: drop-shadow(0 10px 20px rgba(0,0,0,0.2));
|
| 134 |
}
|
| 135 |
/* QR Code section */
|
| 136 |
#gift {
|