Spaces:
Running
Running
Remove the boxes in the boxes, text should only appear on each hover, when each box rovers it should rotate at an angle each both should rotate different to the other
Browse files- index.html +59 -74
index.html
CHANGED
|
@@ -17,8 +17,24 @@
|
|
| 17 |
min-height: 300px;
|
| 18 |
background-size: cover;
|
| 19 |
background-position: center;
|
|
|
|
|
|
|
|
|
|
| 20 |
}
|
| 21 |
-
.bento-box
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
background-image: url('http://static.photos/nature/640x360/1');
|
| 23 |
}
|
| 24 |
.bento-box:nth-child(2) {
|
|
@@ -49,85 +65,49 @@
|
|
| 49 |
<p class="text-xl text-indigo-700 max-w-2xl mx-auto">Interactive animated bento boxes that respond to your cursor</p>
|
| 50 |
</header>
|
| 51 |
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
| 52 |
-
<!-- Box 1 -->
|
| 53 |
-
<div class="bento-box
|
| 54 |
-
<div class="
|
| 55 |
-
<
|
| 56 |
-
|
| 57 |
-
</div>
|
| 58 |
-
<h3 class="text-xl font-semibold text-indigo-900">Box of Ideas</h3>
|
| 59 |
-
</div>
|
| 60 |
-
<p class="text-indigo-700 mb-4">Where creativity meets structure in perfect harmony.</p>
|
| 61 |
-
<div class="flex justify-end">
|
| 62 |
-
<button class="px-4 py-2 bg-indigo-100 text-indigo-700 rounded-lg hover:bg-indigo-200 transition">Explore</button>
|
| 63 |
</div>
|
| 64 |
</div>
|
| 65 |
<!-- Box 2 -->
|
| 66 |
-
<div class="bento-box
|
| 67 |
-
<div class="
|
| 68 |
-
<
|
| 69 |
-
|
| 70 |
-
</div>
|
| 71 |
-
<h3 class="text-xl font-semibold text-purple-900">Energy Pack</h3>
|
| 72 |
-
</div>
|
| 73 |
-
<p class="text-purple-700 mb-4">Boost your productivity with this power-packed module.</p>
|
| 74 |
-
<div class="flex justify-end">
|
| 75 |
-
<button class="px-4 py-2 bg-purple-100 text-purple-700 rounded-lg hover:bg-purple-200 transition">Charge Up</button>
|
| 76 |
</div>
|
| 77 |
</div>
|
| 78 |
<!-- Box 3 -->
|
| 79 |
-
<div class="bento-box
|
| 80 |
-
<div class="
|
| 81 |
-
<
|
| 82 |
-
|
| 83 |
-
</div>
|
| 84 |
-
<h3 class="text-xl font-semibold text-pink-900">Heart Container</h3>
|
| 85 |
-
</div>
|
| 86 |
-
<p class="text-pink-700 mb-4">Store your favorite moments and emotions here.</p>
|
| 87 |
-
<div class="flex justify-end">
|
| 88 |
-
<button class="px-4 py-2 bg-pink-100 text-pink-700 rounded-lg hover:bg-pink-200 transition">Feel It</button>
|
| 89 |
</div>
|
| 90 |
</div>
|
| 91 |
<!-- Box 4 -->
|
| 92 |
-
<div class="bento-box
|
| 93 |
-
<div class="
|
| 94 |
-
<
|
| 95 |
-
|
| 96 |
-
</div>
|
| 97 |
-
<h3 class="text-xl font-semibold text-blue-900">Cloud Vault</h3>
|
| 98 |
-
</div>
|
| 99 |
-
<p class="text-blue-700 mb-4">Your digital treasures safe in the sky.</p>
|
| 100 |
-
<div class="flex justify-end">
|
| 101 |
-
<button class="px-4 py-2 bg-blue-100 text-blue-700 rounded-lg hover:bg-blue-200 transition">Access</button>
|
| 102 |
</div>
|
| 103 |
</div>
|
| 104 |
<!-- Box 5 -->
|
| 105 |
-
<div class="bento-box
|
| 106 |
-
<div class="
|
| 107 |
-
<
|
| 108 |
-
|
| 109 |
-
</div>
|
| 110 |
-
<h3 class="text-xl font-semibold text-green-900">Nature Pod</h3>
|
| 111 |
-
</div>
|
| 112 |
-
<p class="text-green-700 mb-4">A breath of fresh air in digital form.</p>
|
| 113 |
-
<div class="flex justify-end">
|
| 114 |
-
<button class="px-4 py-2 bg-green-100 text-green-700 rounded-lg hover:bg-green-200 transition">Breathe</button>
|
| 115 |
</div>
|
| 116 |
</div>
|
| 117 |
<!-- Box 6 -->
|
| 118 |
-
<div class="bento-box
|
| 119 |
-
<div class="
|
| 120 |
-
<
|
| 121 |
-
|
| 122 |
-
</div>
|
| 123 |
-
<h3 class="text-xl font-semibold text-yellow-900">Stellar Box</h3>
|
| 124 |
-
</div>
|
| 125 |
-
<p class="text-yellow-700 mb-4">Capture shooting stars and cosmic wonders.</p>
|
| 126 |
-
<div class="flex justify-end">
|
| 127 |
-
<button class="px-4 py-2 bg-yellow-100 text-yellow-700 rounded-lg hover:bg-yellow-200 transition">Wish</button>
|
| 128 |
</div>
|
| 129 |
</div>
|
| 130 |
-
|
| 131 |
|
| 132 |
<div class="mt-16 text-center">
|
| 133 |
<button id="animateAll" class="px-6 py-3 bg-indigo-600 text-white rounded-full hover:bg-indigo-700 transition shadow-lg">
|
|
@@ -139,34 +119,39 @@
|
|
| 139 |
<script>
|
| 140 |
document.addEventListener('DOMContentLoaded', function() {
|
| 141 |
feather.replace();
|
| 142 |
-
// Individual box hover effects with
|
| 143 |
const boxes = document.querySelectorAll('.bento-box');
|
| 144 |
boxes.forEach((box, index) => {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
box.addEventListener('mouseenter', function() {
|
| 146 |
anime({
|
| 147 |
targets: this,
|
| 148 |
-
|
|
|
|
|
|
|
| 149 |
duration: 500,
|
| 150 |
easing: 'spring(1, 80, 10, 0)'
|
| 151 |
});
|
| 152 |
-
anime({
|
| 153 |
-
targets: this.querySelectorAll('*'),
|
| 154 |
-
translateY: [-10, 0],
|
| 155 |
-
opacity: [0, 1],
|
| 156 |
-
delay: anime.stagger(100),
|
| 157 |
-
duration: 300,
|
| 158 |
-
easing: 'easeOutQuad'
|
| 159 |
-
});
|
| 160 |
});
|
| 161 |
|
| 162 |
box.addEventListener('mouseleave', function() {
|
| 163 |
anime({
|
| 164 |
targets: this,
|
|
|
|
|
|
|
| 165 |
scale: 1,
|
| 166 |
duration: 600,
|
| 167 |
easing: 'easeOutElastic(1, .5)'
|
| 168 |
});
|
| 169 |
-
});
|
| 170 |
});
|
| 171 |
// Cursor follower effect
|
| 172 |
document.addEventListener('mousemove', function(e) {
|
|
|
|
| 17 |
min-height: 300px;
|
| 18 |
background-size: cover;
|
| 19 |
background-position: center;
|
| 20 |
+
display: flex;
|
| 21 |
+
align-items: center;
|
| 22 |
+
justify-content: center;
|
| 23 |
}
|
| 24 |
+
.bento-box .content {
|
| 25 |
+
opacity: 0;
|
| 26 |
+
transform: translateY(20px);
|
| 27 |
+
transition: all 0.3s ease;
|
| 28 |
+
text-align: center;
|
| 29 |
+
padding: 20px;
|
| 30 |
+
color: white;
|
| 31 |
+
text-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
| 32 |
+
}
|
| 33 |
+
.bento-box:hover .content {
|
| 34 |
+
opacity: 1;
|
| 35 |
+
transform: translateY(0);
|
| 36 |
+
}
|
| 37 |
+
.bento-box:nth-child(1) {
|
| 38 |
background-image: url('http://static.photos/nature/640x360/1');
|
| 39 |
}
|
| 40 |
.bento-box:nth-child(2) {
|
|
|
|
| 65 |
<p class="text-xl text-indigo-700 max-w-2xl mx-auto">Interactive animated bento boxes that respond to your cursor</p>
|
| 66 |
</header>
|
| 67 |
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
|
| 68 |
+
<!-- Box 1 -->
|
| 69 |
+
<div class="bento-box rounded-2xl overflow-hidden">
|
| 70 |
+
<div class="content">
|
| 71 |
+
<h3 class="text-2xl font-bold mb-2">Box of Ideas</h3>
|
| 72 |
+
<p>Where creativity meets structure</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
</div>
|
| 74 |
</div>
|
| 75 |
<!-- Box 2 -->
|
| 76 |
+
<div class="bento-box rounded-2xl overflow-hidden">
|
| 77 |
+
<div class="content">
|
| 78 |
+
<h3 class="text-2xl font-bold mb-2">Energy Pack</h3>
|
| 79 |
+
<p>Boost your productivity</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
</div>
|
| 81 |
</div>
|
| 82 |
<!-- Box 3 -->
|
| 83 |
+
<div class="bento-box rounded-2xl overflow-hidden">
|
| 84 |
+
<div class="content">
|
| 85 |
+
<h3 class="text-2xl font-bold mb-2">Heart Container</h3>
|
| 86 |
+
<p>Store your favorite moments</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
</div>
|
| 88 |
</div>
|
| 89 |
<!-- Box 4 -->
|
| 90 |
+
<div class="bento-box rounded-2xl overflow-hidden">
|
| 91 |
+
<div class="content">
|
| 92 |
+
<h3 class="text-2xl font-bold mb-2">Cloud Vault</h3>
|
| 93 |
+
<p>Your digital treasures</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
</div>
|
| 95 |
</div>
|
| 96 |
<!-- Box 5 -->
|
| 97 |
+
<div class="bento-box rounded-2xl overflow-hidden">
|
| 98 |
+
<div class="content">
|
| 99 |
+
<h3 class="text-2xl font-bold mb-2">Nature Pod</h3>
|
| 100 |
+
<p>A breath of fresh air</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
</div>
|
| 102 |
</div>
|
| 103 |
<!-- Box 6 -->
|
| 104 |
+
<div class="bento-box rounded-2xl overflow-hidden">
|
| 105 |
+
<div class="content">
|
| 106 |
+
<h3 class="text-2xl font-bold mb-2">Stellar Box</h3>
|
| 107 |
+
<p>Cosmic wonders</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
</div>
|
| 109 |
</div>
|
| 110 |
+
</div>
|
| 111 |
|
| 112 |
<div class="mt-16 text-center">
|
| 113 |
<button id="animateAll" class="px-6 py-3 bg-indigo-600 text-white rounded-full hover:bg-indigo-700 transition shadow-lg">
|
|
|
|
| 119 |
<script>
|
| 120 |
document.addEventListener('DOMContentLoaded', function() {
|
| 121 |
feather.replace();
|
| 122 |
+
// Individual box hover effects with rotation
|
| 123 |
const boxes = document.querySelectorAll('.bento-box');
|
| 124 |
boxes.forEach((box, index) => {
|
| 125 |
+
const rotation = [
|
| 126 |
+
{ x: 15, y: -15 }, // top-right
|
| 127 |
+
{ x: -15, y: 15 }, // bottom-left
|
| 128 |
+
{ x: 15, y: 15 }, // top-left
|
| 129 |
+
{ x: -15, y: -15 }, // bottom-right
|
| 130 |
+
{ x: 20, y: -10 }, // slight variation
|
| 131 |
+
{ x: -20, y: 10 } // opposite variation
|
| 132 |
+
];
|
| 133 |
+
|
| 134 |
box.addEventListener('mouseenter', function() {
|
| 135 |
anime({
|
| 136 |
targets: this,
|
| 137 |
+
rotateX: rotation[index].x,
|
| 138 |
+
rotateY: rotation[index].y,
|
| 139 |
+
scale: 1.05,
|
| 140 |
duration: 500,
|
| 141 |
easing: 'spring(1, 80, 10, 0)'
|
| 142 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 143 |
});
|
| 144 |
|
| 145 |
box.addEventListener('mouseleave', function() {
|
| 146 |
anime({
|
| 147 |
targets: this,
|
| 148 |
+
rotateX: 0,
|
| 149 |
+
rotateY: 0,
|
| 150 |
scale: 1,
|
| 151 |
duration: 600,
|
| 152 |
easing: 'easeOutElastic(1, .5)'
|
| 153 |
});
|
| 154 |
+
});
|
| 155 |
});
|
| 156 |
// Cursor follower effect
|
| 157 |
document.addEventListener('mousemove', function(e) {
|