File size: 7,325 Bytes
c6f1ac4
 
 
 
 
 
 
 
 
 
 
 
63fb381
c6f1ac4
63fb381
 
 
 
 
a5d5dbf
 
 
5a6d921
63fb381
5a6d921
a5d5dbf
 
 
 
 
 
 
 
 
 
 
 
 
63fb381
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c6f1ac4
 
5a6d921
63fb381
5a6d921
 
 
 
 
 
63fb381
c6f1ac4
 
 
 
 
 
 
 
63fb381
a5d5dbf
 
 
 
 
c6f1ac4
 
 
a5d5dbf
 
 
 
c6f1ac4
 
 
a5d5dbf
 
 
 
c6f1ac4
 
 
a5d5dbf
 
 
 
c6f1ac4
 
 
a5d5dbf
 
 
 
c6f1ac4
 
 
a5d5dbf
 
 
 
c6f1ac4
 
a5d5dbf
c6f1ac4
 
 
 
 
 
 
 
 
 
 
a5d5dbf
c6f1ac4
63fb381
a5d5dbf
 
 
 
 
 
 
 
c6f1ac4
 
 
5a6d921
 
 
a5d5dbf
63fb381
 
 
5a6d921
 
 
 
 
c6f1ac4
 
 
 
a5d5dbf
 
5a6d921
c6f1ac4
5a6d921
63fb381
 
c6f1ac4
a5d5dbf
5a6d921
63fb381
c6f1ac4
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BentoMotion Boxes</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js"></script>
    <style>
        .bento-box {
            transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
            box-shadow: 0 10px 20px rgba(0,0,0,0.1);
            perspective: 1000px;
            transform-style: preserve-3d;
            min-height: 300px;
            background-size: cover;
            background-position: center;
            display: flex;
            align-items: center;
            justify-content: center;
            transform: rotate3d(1, 1, 0, 15deg);
        }
.bento-box .content {
            opacity: 0;
            transform: translateY(20px);
            transition: all 0.3s ease;
            text-align: center;
            padding: 20px;
            color: white;
            text-shadow: 0 1px 3px rgba(0,0,0,0.3);
        }
        .bento-box:hover .content {
            opacity: 1;
            transform: translateY(0);
        }
.bento-box:nth-child(1) {
            background-image: url('http://static.photos/nature/640x360/1');
        }
        .bento-box:nth-child(2) {
            background-image: url('http://static.photos/technology/640x360/2');
        }
        .bento-box:nth-child(3) {
            background-image: url('http://static.photos/people/640x360/3');
        }
        .bento-box:nth-child(4) {
            background-image: url('http://static.photos/aerial/640x360/4');
        }
        .bento-box:nth-child(5) {
            background-image: url('http://static.photos/green/640x360/5');
        }
        .bento-box:nth-child(6) {
            background-image: url('http://static.photos/blue/640x360/6');
        }
        .bento-box:hover {
            transform: scale(1.05) rotate3d(1, 1, 0, -15deg);
            box-shadow: 0 25px 50px rgba(0,0,0,0.25);
            filter: blur(2px);
        }
        .bento-box:hover .content {
            opacity: 1;
            transform: translateY(0);
            filter: none;
        }
</style>
</head>
<body class="bg-gradient-to-br from-indigo-50 to-purple-50 min-h-screen">
    <div class="container mx-auto px-4 py-12">
        <header class="text-center mb-16">
            <h1 class="text-5xl font-bold text-indigo-900 mb-4">BentoMotion</h1>
            <p class="text-xl text-indigo-700 max-w-2xl mx-auto">Interactive animated bento boxes that respond to your cursor</p>
        </header>
        <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
            <!-- Box 1 -->
            <div class="bento-box rounded-2xl overflow-hidden">
                <div class="content">
                    <h3 class="text-2xl font-bold mb-2">Box of Ideas</h3>
                    <p>Where creativity meets structure</p>
                </div>
            </div>
            <!-- Box 2 -->
            <div class="bento-box rounded-2xl overflow-hidden">
                <div class="content">
                    <h3 class="text-2xl font-bold mb-2">Energy Pack</h3>
                    <p>Boost your productivity</p>
                </div>
            </div>
            <!-- Box 3 -->
            <div class="bento-box rounded-2xl overflow-hidden">
                <div class="content">
                    <h3 class="text-2xl font-bold mb-2">Heart Container</h3>
                    <p>Store your favorite moments</p>
                </div>
            </div>
            <!-- Box 4 -->
            <div class="bento-box rounded-2xl overflow-hidden">
                <div class="content">
                    <h3 class="text-2xl font-bold mb-2">Cloud Vault</h3>
                    <p>Your digital treasures</p>
                </div>
            </div>
            <!-- Box 5 -->
            <div class="bento-box rounded-2xl overflow-hidden">
                <div class="content">
                    <h3 class="text-2xl font-bold mb-2">Nature Pod</h3>
                    <p>A breath of fresh air</p>
                </div>
            </div>
            <!-- Box 6 -->
            <div class="bento-box rounded-2xl overflow-hidden">
                <div class="content">
                    <h3 class="text-2xl font-bold mb-2">Stellar Box</h3>
                    <p>Cosmic wonders</p>
                </div>
            </div>
</div>

        <div class="mt-16 text-center">
            <button id="animateAll" class="px-6 py-3 bg-indigo-600 text-white rounded-full hover:bg-indigo-700 transition shadow-lg">
                Activate Group Animation
            </button>
        </div>
    </div>

    <script>
        document.addEventListener('DOMContentLoaded', function() {
            feather.replace();
            // Individual box hover effects with rotation
            const boxes = document.querySelectorAll('.bento-box');
            boxes.forEach((box, index) => {
                const rotation = [
                    { x: 15, y: -15 },  // top-right
                    { x: -15, y: 15 },  // bottom-left
                    { x: 15, y: 15 },   // top-left
                    { x: -15, y: -15 }, // bottom-right
                    { x: 20, y: -10 },  // slight variation
                    { x: -20, y: 10 }   // opposite variation
                ];
                box.addEventListener('mouseenter', function() {
                    anime({
                        targets: this,
                        rotateX: rotation[index].x * 2,
                        rotateY: rotation[index].y * 2,
                        rotateZ: rotation[index].x * 0.5,
                        scale: 1.05,
                        duration: 500,
                        easing: 'spring(1, 80, 10, 0)'
                    });
                    anime({
                        targets: this,
                        filter: 'blur(5px)',
                        duration: 300
                    });
                });
                box.addEventListener('mouseleave', function() {
                    anime({
                        targets: this,
                        rotateX: 0,
                        rotateY: 0,
                        rotateZ: 0,
                        scale: 1,
                        filter: 'blur(0px)',
                        duration: 600,
                        easing: 'easeOutElastic(1, .5)'
                    });
                });
});
// Cursor follower effect
document.addEventListener('mousemove', function(e) {
                const cursor = document.createElement('div');
                cursor.className = 'cursor-follower';
                cursor.style.position = 'fixed';
                cursor.style.width = '20px';
                cursor.style.height = '20px';
                cursor.style.backgroundColor = 'rgba(99, 102, 241, 0.3)';
                cursor.style.borderRadius = '50%';
                cursor.style.pointerEvents = 'none';
                cursor.style.left = e.clientX + 'px';
                cursor.style.top = e.client
</body>
</html>