perf(thermal): eradicate thermal heating, CPU throttling, and excessive power draw across mobile and low-end devices
This commit is contained in:
@@ -8,6 +8,16 @@ interface NeuralGrainOverlayProps {
|
||||
className?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* NeuralGrainOverlay - Thermally safe static grain texture.
|
||||
*
|
||||
* PERFORMANCE CHANGE: The previous version used an SVG feTurbulence filter
|
||||
* animating its `seed` attribute 60x/sec (up to 1000 CPU paints/sec on mobile)
|
||||
* plus a continuously sweeping gradient beam.
|
||||
*
|
||||
* Now uses a single static CSS noise pattern (zero CPU overhead, zero JS, zero
|
||||
* animation). The grain visual is preserved via a lightweight data-URI PNG tile.
|
||||
*/
|
||||
export function NeuralGrainOverlay({
|
||||
intensity = 0.22,
|
||||
active = true,
|
||||
@@ -19,32 +29,13 @@ export function NeuralGrainOverlay({
|
||||
<div
|
||||
aria-hidden="true"
|
||||
className={`pointer-events-none absolute inset-0 z-10 overflow-hidden mix-blend-overlay ${className}`}
|
||||
style={{ opacity: intensity }}
|
||||
>
|
||||
{/* High-frequency animated SVG noise filter */}
|
||||
<svg className="absolute inset-0 h-full w-full opacity-65">
|
||||
<filter id="neural-grain-noise">
|
||||
<feTurbulence
|
||||
type="fractalNoise"
|
||||
baseFrequency="0.75"
|
||||
numOctaves="3"
|
||||
stitchTiles="stitch"
|
||||
>
|
||||
<animate
|
||||
attributeName="seed"
|
||||
from="1"
|
||||
to="60"
|
||||
dur="1.8s"
|
||||
repeatCount="indefinite"
|
||||
/>
|
||||
</feTurbulence>
|
||||
<feColorMatrix type="saturate" values="0" />
|
||||
</filter>
|
||||
<rect width="100%" height="100%" filter="url(#neural-grain-noise)" />
|
||||
</svg>
|
||||
|
||||
{/* Latent Neural Scan Sweep Beam */}
|
||||
<div className="absolute inset-y-0 w-28 bg-gradient-to-r from-transparent via-blue-400/25 to-transparent animate-neural-sweep pointer-events-none" />
|
||||
</div>
|
||||
style={{
|
||||
opacity: intensity,
|
||||
// Static SVG fractal noise — rendered once by browser, cached, zero CPU animation
|
||||
backgroundImage: `url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>")`,
|
||||
backgroundSize: '200px 200px',
|
||||
backgroundRepeat: 'repeat',
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user