Skip to content

Commit 3adde0e

Browse files
committed
feat(lab):blur fade
1 parent 0e61660 commit 3adde0e

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed
14.7 KB
Loading

src/data/labs/blur-fade/page.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { useState } from "react";
2+
import cover from "./assets/cover.webp";
3+
4+
5+
export default function Blurfade() {
6+
const [isActive, setIsActive] = useState<boolean>(false);
7+
return (
8+
<div onClick={() => setIsActive(!isActive)} className="relative w-full h-full flex flex-col gap-2 p-2 items-center justify-center">
9+
<div className="relative cursor-pointer w-1/2 h-full overflow-hidden rounded-xl border-2 border-zinc-500/10">
10+
<div className="relative w-full h-full rounded-xl overflow-hidden">
11+
<img src={cover} alt="placeholder" className="w-full h-full object-cover" />
12+
</div>
13+
<div className="absolute w-full h-full top-0 left-0 rounded-xl">
14+
{
15+
Array.from({ length: 10 }).map((_, index) => (
16+
<div key={index} className="absolute top-0 left-0 w-full h-full" style={{
17+
zIndex: index + 1,
18+
backdropFilter: isActive ? `blur(${Math.pow(2, index)}px)` : "blur(0px)",
19+
mask: `radial-gradient(circle, rgba(0, 0, 0, 0) ${21 + index * 8}%, rgba(0, 0, 0, 1) ${29 + index * 8}%)`,
20+
WebkitMask: `radial-gradient(circle, rgba(0, 0, 0, 0) ${21 + index * 8}%, rgba(0, 0, 0, 1) ${29 + index * 8}%)`,
21+
transition: "all 0.5s ease-in-out",
22+
transitionProperty: "backdrop-filter",
23+
willChange: "backdrop-filter",
24+
borderRadius: "inherit",
25+
}}></div>
26+
))
27+
}
28+
</div>
29+
</div>
30+
<p>Click It</p>
31+
</div>
32+
)
33+
}

src/data/labs/data.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
{
2+
"blur-fade": {
3+
"name": "blur-fade",
4+
"inDevelopment": false,
5+
"en_title": "Blur Fade",
6+
"origin_url": "",
7+
"title": "高斯模糊淡出",
8+
"tags": [
9+
"Motion",
10+
"Tailwind"
11+
]
12+
},
213
"3d-hover-card": {
314
"name": "3d-hover-card",
415
"inDevelopment": false,

0 commit comments

Comments
 (0)