Spaces:
Running
Running
the boxes need to rotate at an angle when they hover, the image should also blur so the text is easily readable
Browse files- index.html +20 -7
index.html
CHANGED
|
@@ -20,8 +20,9 @@
|
|
| 20 |
display: flex;
|
| 21 |
align-items: center;
|
| 22 |
justify-content: center;
|
|
|
|
| 23 |
}
|
| 24 |
-
|
| 25 |
opacity: 0;
|
| 26 |
transform: translateY(20px);
|
| 27 |
transition: all 0.3s ease;
|
|
@@ -53,8 +54,14 @@
|
|
| 53 |
background-image: url('http://static.photos/blue/640x360/6');
|
| 54 |
}
|
| 55 |
.bento-box:hover {
|
| 56 |
-
transform: scale(1.05);
|
| 57 |
box-shadow: 0 25px 50px rgba(0,0,0,0.25);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
}
|
| 59 |
</style>
|
| 60 |
</head>
|
|
@@ -130,29 +137,35 @@
|
|
| 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) {
|
| 158 |
const cursor = document.createElement('div');
|
|
|
|
| 20 |
display: flex;
|
| 21 |
align-items: center;
|
| 22 |
justify-content: center;
|
| 23 |
+
transform: rotate3d(1, 1, 0, 15deg);
|
| 24 |
}
|
| 25 |
+
.bento-box .content {
|
| 26 |
opacity: 0;
|
| 27 |
transform: translateY(20px);
|
| 28 |
transition: all 0.3s ease;
|
|
|
|
| 54 |
background-image: url('http://static.photos/blue/640x360/6');
|
| 55 |
}
|
| 56 |
.bento-box:hover {
|
| 57 |
+
transform: scale(1.05) rotate3d(1, 1, 0, -15deg);
|
| 58 |
box-shadow: 0 25px 50px rgba(0,0,0,0.25);
|
| 59 |
+
filter: blur(2px);
|
| 60 |
+
}
|
| 61 |
+
.bento-box:hover .content {
|
| 62 |
+
opacity: 1;
|
| 63 |
+
transform: translateY(0);
|
| 64 |
+
filter: none;
|
| 65 |
}
|
| 66 |
</style>
|
| 67 |
</head>
|
|
|
|
| 137 |
{ x: 20, y: -10 }, // slight variation
|
| 138 |
{ x: -20, y: 10 } // opposite variation
|
| 139 |
];
|
|
|
|
| 140 |
box.addEventListener('mouseenter', function() {
|
| 141 |
anime({
|
| 142 |
targets: this,
|
| 143 |
+
rotateX: rotation[index].x * 2,
|
| 144 |
+
rotateY: rotation[index].y * 2,
|
| 145 |
+
rotateZ: rotation[index].x * 0.5,
|
| 146 |
scale: 1.05,
|
| 147 |
duration: 500,
|
| 148 |
easing: 'spring(1, 80, 10, 0)'
|
| 149 |
});
|
| 150 |
+
anime({
|
| 151 |
+
targets: this,
|
| 152 |
+
filter: 'blur(5px)',
|
| 153 |
+
duration: 300
|
| 154 |
+
});
|
| 155 |
});
|
|
|
|
| 156 |
box.addEventListener('mouseleave', function() {
|
| 157 |
anime({
|
| 158 |
targets: this,
|
| 159 |
rotateX: 0,
|
| 160 |
rotateY: 0,
|
| 161 |
+
rotateZ: 0,
|
| 162 |
scale: 1,
|
| 163 |
+
filter: 'blur(0px)',
|
| 164 |
duration: 600,
|
| 165 |
easing: 'easeOutElastic(1, .5)'
|
| 166 |
});
|
| 167 |
});
|
| 168 |
+
});
|
| 169 |
// Cursor follower effect
|
| 170 |
document.addEventListener('mousemove', function(e) {
|
| 171 |
const cursor = document.createElement('div');
|