Builtgrowth commited on
Commit
63fb381
·
verified ·
1 Parent(s): c6f1ac4

Now make the Bento Boxes larger so they can accomodate images for the background, when the mouse hovers over each box, it should have a 3d like element effect and rotate at an angle, each box should angle in a different direction

Browse files
Files changed (1) hide show
  1. index.html +70 -20
index.html CHANGED
@@ -10,12 +10,50 @@
10
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
11
  <style>
12
  .bento-box {
13
- transition: all 0.3s ease;
14
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
  .bento-box:hover {
17
- transform: scale(1.03) translateY(-10px);
18
- box-shadow: 0 15px 30px rgba(0,0,0,0.15);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  }
20
  </style>
21
  </head>
@@ -25,10 +63,9 @@
25
  <h1 class="text-5xl font-bold text-indigo-900 mb-4">BentoMotion</h1>
26
  <p class="text-xl text-indigo-700 max-w-2xl mx-auto">Interactive animated bento boxes that respond to your cursor</p>
27
  </header>
28
-
29
- <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
30
- <!-- Box 1 -->
31
- <div class="bento-box bg-white rounded-2xl p-6">
32
  <div class="flex items-center mb-4">
33
  <div class="w-12 h-12 rounded-lg bg-indigo-100 flex items-center justify-center mr-4">
34
  <i data-feather="box" class="text-indigo-600"></i>
@@ -41,7 +78,7 @@
41
  </div>
42
  </div>
43
  <!-- Box 2 -->
44
- <div class="bento-box bg-white rounded-2xl p-6">
45
  <div class="flex items-center mb-4">
46
  <div class="w-12 h-12 rounded-lg bg-purple-100 flex items-center justify-center mr-4">
47
  <i data-feather="zap" class="text-purple-600"></i>
@@ -54,7 +91,7 @@
54
  </div>
55
  </div>
56
  <!-- Box 3 -->
57
- <div class="bento-box bg-white rounded-2xl p-6">
58
  <div class="flex items-center mb-4">
59
  <div class="w-12 h-12 rounded-lg bg-pink-100 flex items-center justify-center mr-4">
60
  <i data-feather="heart" class="text-pink-600"></i>
@@ -67,7 +104,7 @@
67
  </div>
68
  </div>
69
  <!-- Box 4 -->
70
- <div class="bento-box bg-white rounded-2xl p-6">
71
  <div class="flex items-center mb-4">
72
  <div class="w-12 h-12 rounded-lg bg-blue-100 flex items-center justify-center mr-4">
73
  <i data-feather="cloud" class="text-blue-600"></i>
@@ -80,7 +117,7 @@
80
  </div>
81
  </div>
82
  <!-- Box 5 -->
83
- <div class="bento-box bg-white rounded-2xl p-6">
84
  <div class="flex items-center mb-4">
85
  <div class="w-12 h-12 rounded-lg bg-green-100 flex items-center justify-center mr-4">
86
  <i data-feather="leaf" class="text-green-600"></i>
@@ -93,7 +130,7 @@
93
  </div>
94
  </div>
95
  <!-- Box 6 -->
96
- <div class="bento-box bg-white rounded-2xl p-6">
97
  <div class="flex items-center mb-4">
98
  <div class="w-12 h-12 rounded-lg bg-yellow-100 flex items-center justify-center mr-4">
99
  <i data-feather="star" class="text-yellow-600"></i>
@@ -117,28 +154,41 @@
117
  <script>
118
  document.addEventListener('DOMContentLoaded', function() {
119
  feather.replace();
120
-
121
- // Individual box hover effects
122
  const boxes = document.querySelectorAll('.bento-box');
123
- boxes.forEach(box => {
124
  box.addEventListener('mouseenter', function() {
125
  anime({
126
  targets: this,
127
- scale: 1.05,
 
 
 
 
 
 
 
 
 
 
 
128
  duration: 300,
129
- easing: 'easeOutExpo'
130
  });
131
  });
 
132
  box.addEventListener('mouseleave', function() {
133
  anime({
134
  targets: this,
135
  scale: 1,
136
- duration: 300,
137
- easing: 'easeOutExpo'
 
 
138
  });
139
  });
140
  });
141
- // Cursor follower effect
142
  document.addEventListener('mousemove', function(e) {
143
  const cursor = document.createElement('div');
144
  cursor.className = 'cursor-follower';
 
10
  <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
11
  <style>
12
  .bento-box {
13
+ transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
14
  box-shadow: 0 10px 20px rgba(0,0,0,0.1);
15
+ perspective: 1000px;
16
+ transform-style: preserve-3d;
17
+ min-height: 300px;
18
+ background-size: cover;
19
+ background-position: center;
20
+ }
21
+ .bento-box:nth-child(1) {
22
+ background-image: url('http://static.photos/nature/640x360/1');
23
+ }
24
+ .bento-box:nth-child(2) {
25
+ background-image: url('http://static.photos/technology/640x360/2');
26
+ }
27
+ .bento-box:nth-child(3) {
28
+ background-image: url('http://static.photos/people/640x360/3');
29
+ }
30
+ .bento-box:nth-child(4) {
31
+ background-image: url('http://static.photos/aerial/640x360/4');
32
+ }
33
+ .bento-box:nth-child(5) {
34
+ background-image: url('http://static.photos/green/640x360/5');
35
+ }
36
+ .bento-box:nth-child(6) {
37
+ background-image: url('http://static.photos/blue/640x360/6');
38
  }
39
  .bento-box:hover {
40
+ transform: scale(1.05) rotate3d(1, 1, 0, 15deg);
41
+ box-shadow: 0 25px 50px rgba(0,0,0,0.25);
42
+ }
43
+ .bento-box:nth-child(2):hover {
44
+ transform: scale(1.05) rotate3d(-1, 1, 0, 15deg);
45
+ }
46
+ .bento-box:nth-child(3):hover {
47
+ transform: scale(1.05) rotate3d(0, 1, 1, 15deg);
48
+ }
49
+ .bento-box:nth-child(4):hover {
50
+ transform: scale(1.05) rotate3d(1, 0, 1, 15deg);
51
+ }
52
+ .bento-box:nth-child(5):hover {
53
+ transform: scale(1.05) rotate3d(1, -1, 0, 15deg);
54
+ }
55
+ .bento-box:nth-child(6):hover {
56
+ transform: scale(1.05) rotate3d(0, -1, 1, 15deg);
57
  }
58
  </style>
59
  </head>
 
63
  <h1 class="text-5xl font-bold text-indigo-900 mb-4">BentoMotion</h1>
64
  <p class="text-xl text-indigo-700 max-w-2xl mx-auto">Interactive animated bento boxes that respond to your cursor</p>
65
  </header>
66
+ <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
67
+ <!-- Box 1 -->
68
+ <div class="bento-box bg-white/80 backdrop-blur-sm rounded-2xl p-8 overflow-hidden">
 
69
  <div class="flex items-center mb-4">
70
  <div class="w-12 h-12 rounded-lg bg-indigo-100 flex items-center justify-center mr-4">
71
  <i data-feather="box" class="text-indigo-600"></i>
 
78
  </div>
79
  </div>
80
  <!-- Box 2 -->
81
+ <div class="bento-box bg-white/80 backdrop-blur-sm rounded-2xl p-8 overflow-hidden">
82
  <div class="flex items-center mb-4">
83
  <div class="w-12 h-12 rounded-lg bg-purple-100 flex items-center justify-center mr-4">
84
  <i data-feather="zap" class="text-purple-600"></i>
 
91
  </div>
92
  </div>
93
  <!-- Box 3 -->
94
+ <div class="bento-box bg-white/80 backdrop-blur-sm rounded-2xl p-8 overflow-hidden">
95
  <div class="flex items-center mb-4">
96
  <div class="w-12 h-12 rounded-lg bg-pink-100 flex items-center justify-center mr-4">
97
  <i data-feather="heart" class="text-pink-600"></i>
 
104
  </div>
105
  </div>
106
  <!-- Box 4 -->
107
+ <div class="bento-box bg-white/80 backdrop-blur-sm rounded-2xl p-8 overflow-hidden">
108
  <div class="flex items-center mb-4">
109
  <div class="w-12 h-12 rounded-lg bg-blue-100 flex items-center justify-center mr-4">
110
  <i data-feather="cloud" class="text-blue-600"></i>
 
117
  </div>
118
  </div>
119
  <!-- Box 5 -->
120
+ <div class="bento-box bg-white/80 backdrop-blur-sm rounded-2xl p-8 overflow-hidden">
121
  <div class="flex items-center mb-4">
122
  <div class="w-12 h-12 rounded-lg bg-green-100 flex items-center justify-center mr-4">
123
  <i data-feather="leaf" class="text-green-600"></i>
 
130
  </div>
131
  </div>
132
  <!-- Box 6 -->
133
+ <div class="bento-box bg-white/80 backdrop-blur-sm rounded-2xl p-8 overflow-hidden">
134
  <div class="flex items-center mb-4">
135
  <div class="w-12 h-12 rounded-lg bg-yellow-100 flex items-center justify-center mr-4">
136
  <i data-feather="star" class="text-yellow-600"></i>
 
154
  <script>
155
  document.addEventListener('DOMContentLoaded', function() {
156
  feather.replace();
157
+ // Individual box hover effects with enhanced 3D
 
158
  const boxes = document.querySelectorAll('.bento-box');
159
+ boxes.forEach((box, index) => {
160
  box.addEventListener('mouseenter', function() {
161
  anime({
162
  targets: this,
163
+ scale: [1, 1.05],
164
+ rotateX: index % 2 === 0 ? [0, 15] : [0, -15],
165
+ rotateY: index % 3 === 0 ? [0, 15] : [0, -15],
166
+ duration: 500,
167
+ easing: 'spring(1, 80, 10, 0)'
168
+ });
169
+
170
+ anime({
171
+ targets: this.querySelectorAll('*'),
172
+ translateY: [-10, 0],
173
+ opacity: [0, 1],
174
+ delay: anime.stagger(100),
175
  duration: 300,
176
+ easing: 'easeOutQuad'
177
  });
178
  });
179
+
180
  box.addEventListener('mouseleave', function() {
181
  anime({
182
  targets: this,
183
  scale: 1,
184
+ rotateX: 0,
185
+ rotateY: 0,
186
+ duration: 600,
187
+ easing: 'easeOutElastic(1, .5)'
188
  });
189
  });
190
  });
191
+ // Cursor follower effect
192
  document.addEventListener('mousemove', function(e) {
193
  const cursor = document.createElement('div');
194
  cursor.className = 'cursor-follower';