mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-15 15:46:30 +03:00
- Add @paper-design/shaders for WebGL mesh gradient effect - Create hero-shader.js with liquid ink gradient (grayscale palette) - Add overlay content: title, tagline, and CTA on shader - Update hero section structure and styling - Fix accessibility: gallery dot buttons, toggle ARIA attributes - Fix undefined --color-terracotta CSS variable - Update distribution structure for Codex/Cursor skills 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
58 lines
1.3 KiB
JavaScript
58 lines
1.3 KiB
JavaScript
import {
|
|
ShaderMount,
|
|
meshGradientFragmentShader,
|
|
getShaderColorFromString,
|
|
ShaderFitOptions
|
|
} from '@paper-design/shaders';
|
|
|
|
export function initHeroShader() {
|
|
const container = document.getElementById('hero-shader');
|
|
if (!container) return;
|
|
|
|
// Respect user's motion preferences
|
|
if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) {
|
|
container.style.display = 'none';
|
|
return;
|
|
}
|
|
|
|
// Liquid ink mesh gradient
|
|
const shader = new ShaderMount(
|
|
container,
|
|
meshGradientFragmentShader,
|
|
{
|
|
// Colors - liquid ink effect (grayscale tones for editorial look)
|
|
u_colors: [
|
|
getShaderColorFromString('#ffffff'),
|
|
getShaderColorFromString('#e8e4df'),
|
|
getShaderColorFromString('#b5b0a8'),
|
|
getShaderColorFromString('#1a1a1a'),
|
|
],
|
|
u_colorsCount: 4,
|
|
|
|
// Effect parameters
|
|
u_distortion: 1.0,
|
|
u_swirl: 0.2,
|
|
u_grainMixer: 0,
|
|
u_grainOverlay: 0,
|
|
|
|
// Sizing uniforms (required by mesh gradient)
|
|
u_fit: ShaderFitOptions.cover,
|
|
u_scale: 1,
|
|
u_rotation: 0,
|
|
u_offsetX: 0,
|
|
u_offsetY: 0,
|
|
u_originX: 0.5,
|
|
u_originY: 0.5,
|
|
u_worldWidth: 0,
|
|
u_worldHeight: 0,
|
|
},
|
|
undefined,
|
|
1.0 // speed
|
|
);
|
|
|
|
// Cleanup
|
|
window.addEventListener('beforeunload', () => {
|
|
shader.dispose();
|
|
});
|
|
}
|