diff --git a/src/app.tsx b/src/app.tsx index d5b0548..5793921 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -77,13 +77,22 @@ type SymbolData = { }; function SymbolBurst() { - const pds = new PoissonDiskSampling({ + const getPoissonDiskSampler = () => new PoissonDiskSampling({ shape: [window.innerHeight, window.innerWidth], minDistance: (window.innerWidth + window.innerHeight) / 20, maxDistance: (window.innerWidth + window.innerHeight) / 5, tries: 10, }); + const pds = getPoissonDiskSampler(); + + const handleResizeEvent = (event: any) => getPoissonDiskSampler(); + + useEffect(() => { + addEventListener('resize', handleResizeEvent); + return () => removeEventListener('resize', handleResizeEvent); + }, []); + const symbolData = useMemo(() => { const symbolData: SymbolData[] = []; const points = pds.fill(); @@ -94,11 +103,11 @@ function SymbolBurst() { positionPx: [point[0], point[1]], sizeEm: 1 + Math.random() * 2, zIndex: 2 * Math.floor(2 * Math.random()), - innerAnimationDelaySec: -Math.random() * 15, + innerAnimationDelaySec: -Math.random() * 30, }); } return symbolData; - }, []); + }, [window.innerWidth, window.innerHeight]); return (
- Type to change · Shirt · E.P. · Website + Click to edit · Shirt · E.P. · Made by Ash
) diff --git a/src/index.css b/src/index.css index 73c96ab..6f385e0 100644 --- a/src/index.css +++ b/src/index.css @@ -114,6 +114,7 @@ p { bottom: 2em; width: 100%; text-align: center; + z-index: 10; } textarea:focus { @@ -125,6 +126,7 @@ textarea:focus { max-width: 100%; max-height: 100%; pointer-events: none; + user-select: none; font-size: calc(.8vw + .8vh); overflow: hidden; animation-name: symbol-burst-container; @@ -149,9 +151,10 @@ textarea:focus { } -.symbol-burst .symbol span { +.symbol-burst .symbol span:not(.●) { display: inline-block; - animation: symbol-inner 15s infinite; + animation: symbol-inner 30s infinite; + animation-timing-function: ease; } @keyframes symbol-inner { @@ -159,71 +162,15 @@ textarea:focus { transform: rotate(0deg); } - 4% { - transform: rotate(3.92deg); + 45% { + transform: rotate(180deg); } + + 55% { + transform: rotate(-180deg); + } - 8% { - transform: rotate(7.9deg); - } - - 18% { - transform: rotate(18.52deg); - } - - 20% { - transform: rotate(20.39deg); - } - - 28% { - transform: rotate(25.65deg); - } - - 30% { - transform: rotate(27.61deg); - } - - 38% { - transform: rotate(47.27deg); - } - - 40% { - transform: rotate(51.75deg); - } - - 60% { - transform: rotate(-51.75deg); - } - - 62% { - transform: rotate(-47.27deg); - } - - 70% { - transform: rotate(-27.61deg); - } - - 72% { - transform: rotate(-25.65deg); - } - - 80% { - transform: rotate(-20.39deg); - } - - 82% { - transform: rotate(-18.52deg); - } - - 90% { - transform: rotate(-9.97deg); - } - - 92% { - transform: rotate(-7.9deg); - } - - 100% { - transform: rotate(0deg); - } + 100% { + transform: rotate(0deg); + } } \ No newline at end of file