Skip to content

Basinfy/Basinfy-SaaS-Studio / .claude/skills/saas-frontend-taste

saas-frontend-taste

Verified

Design, refine, and verify SaaS screens with anti-slop copy and responsive layout checks.

FileKindSize
SKILL.mdskill md11.1 KB
assets/backgrounds/backgrounds.cssother41.5 KB
assets/backgrounds/backgrounds.jsscript8.9 KB
assets/backgrounds/check.htmlother4.8 KB
assets/backgrounds/check.mjsscript14.2 KB
assets/backgrounds/demo.htmlother43.3 KB
assets/backgrounds/index.jsonconfig19.6 KB
assets/backgrounds/pick.mjsscript14.0 KB
assets/diagrams/demo.htmlother11.4 KB
assets/diagrams/diagram.cssother25.5 KB
assets/diagrams/diagram.jsscript89.2 KB
assets/diagrams/lab.htmlother11.2 KB
assets/diagrams/mount.jsscript609 B
assets/diagrams/presets.jsonconfig27.9 KB
assets/layout/check.mjsscript15.8 KB
assets/layout/deal.mjsscript9.5 KB
assets/layout/demo.cssother5.7 KB
assets/layout/fonts.htmlother9.5 KB
assets/layout/hero-centred.htmlother16.4 KB
assets/layout/hero-collage.htmlother15.7 KB
assets/layout/hero-editorial.htmlother8.1 KB
assets/layout/hero-film.htmlother7.8 KB
assets/layout/hero-photo.htmlother7.8 KB
assets/layout/hero-place.htmlother6.7 KB
assets/layout/hero-product.htmlother7.7 KB
assets/layout/hero-split.htmlother7.8 KB
assets/layout/hero-statement.htmlother8.4 KB
assets/layout/hero-triptych.htmlother14.2 KB
assets/layout/hero-word.htmlother10.1 KB
assets/layout/heroes.jsonconfig36.7 KB
assets/layout/img/credits.jsonconfig8.2 KB
assets/layout/img/photo-1068.jpgbinary48.0 KB
assets/layout/img/photo-1081.jpgbinary40.5 KB
assets/layout/img/photo-465.jpgbinary19.6 KB
assets/layout/img/photo-559.jpgbinary86.2 KB
assets/layout/img/photo-855.jpgbinary25.8 KB
assets/layout/img/photo-887.jpgbinary66.8 KB
assets/layout/img/photo-949.jpgbinary37.1 KB
assets/layout/img/photo-954.jpgbinary17.4 KB
assets/layout/img/photo-beans-hand.jpgbinary17.1 KB
assets/layout/img/photo-c166.jpgbinary32.3 KB
assets/layout/img/photo-c400.jpgbinary98.8 KB
assets/layout/img/photo-c7.jpgbinary24.7 KB
assets/layout/img/photo-c70.jpgbinary32.4 KB
assets/layout/img/photo-c8.jpgbinary25.1 KB
assets/layout/img/photo-c823.jpgbinary34.7 KB
assets/layout/img/photo-c96.jpgbinary33.0 KB
assets/layout/img/photo-d534.jpgbinary121.7 KB
assets/layout/img/photo-d540.jpgbinary119.9 KB
assets/layout/img/photo-d88.jpgbinary38.8 KB
assets/layout/img/photo-m61660576.jpgbinary39.5 KB
assets/layout/img/photo-m61757972.jpgbinary43.6 KB
assets/layout/layout-check.jsscript21.1 KB
assets/layout/layout.cssother44.4 KB
assets/layout/layout.jsscript14.8 KB
assets/moments/_demo/credits.jsonconfig1.3 KB
assets/moments/_demo/demo.cssother6.8 KB
assets/moments/_demo/in-card.htmlother1.8 KB
assets/moments/_demo/in-page-service.htmlother10.3 KB
assets/moments/_demo/in-page.htmlother9.6 KB
assets/moments/_demo/photo-1049-tall.jpgbinary36.5 KB
assets/moments/_demo/photo-1049.jpgbinary27.9 KB
assets/moments/_demo/photo-1081.jpgbinary39.9 KB
assets/moments/_demo/photo-640.jpgbinary102.7 KB
assets/moments/_demo/photo-702-tall.jpgbinary100.0 KB
assets/moments/_demo/photo-702.jpgbinary80.0 KB
assets/moments/_demo/photo-855.jpgbinary25.4 KB
assets/moments/_demo/photo-887.jpgbinary62.7 KB
assets/moments/closing-lift/demo.htmlother4.3 KB
assets/moments/closing-lift/meta.jsonconfig1.3 KB
assets/moments/closing-lift/moment.cssother2.3 KB
assets/moments/closing-lift/moment.jsscript2.9 KB
assets/moments/counter-rolls/demo.htmlother5.3 KB
assets/moments/counter-rolls/meta.jsonconfig913 B
assets/moments/counter-rolls/moment.cssother718 B
assets/moments/counter-rolls/moment.jsscript3.3 KB
assets/moments/cursor-spotlight/demo.htmlother4.3 KB
assets/moments/cursor-spotlight/meta.jsonconfig1.2 KB
assets/moments/cursor-spotlight/moment.cssother1.2 KB
assets/moments/cursor-spotlight/moment.jsscript2.2 KB
assets/moments/gallery.htmlother8.2 KB
assets/moments/giant-type-pass/demo.htmlother3.6 KB
assets/moments/giant-type-pass/meta.jsonconfig1.0 KB
assets/moments/giant-type-pass/moment.cssother1.5 KB
assets/moments/giant-type-pass/moment.jsscript2.0 KB
assets/moments/headline-arrives/demo.htmlother3.9 KB
assets/moments/headline-arrives/meta.jsonconfig1.0 KB
assets/moments/headline-arrives/moment.cssother1.6 KB
assets/moments/headline-arrives/moment.jsscript2.6 KB
assets/moments/index.jsonconfig21.4 KB
assets/moments/iris-opens/demo.htmlother4.9 KB
assets/moments/iris-opens/meta.jsonconfig1.3 KB
assets/moments/iris-opens/moment.cssother2.0 KB
assets/moments/iris-opens/moment.jsscript4.6 KB
assets/moments/letters-assemble/demo.htmlother4.2 KB
assets/moments/letters-assemble/meta.jsonconfig1.0 KB
assets/moments/letters-assemble/moment.cssother1.1 KB
assets/moments/letters-assemble/moment.jsscript2.9 KB
assets/moments/lib.jsscript10.5 KB
assets/moments/line-carries-colour/demo.htmlother4.4 KB
assets/moments/line-carries-colour/meta.jsonconfig1.4 KB
assets/moments/line-carries-colour/moment.cssother1.6 KB
assets/moments/line-carries-colour/moment.jsscript4.0 KB
assets/moments/lines-rise/demo.htmlother5.1 KB
assets/moments/lines-rise/meta.jsonconfig984 B
assets/moments/lines-rise/moment.cssother1.3 KB
assets/moments/lines-rise/moment.jsscript3.0 KB
assets/moments/liquid-hover/demo.htmlother3.3 KB
assets/moments/liquid-hover/meta.jsonconfig1.4 KB
assets/moments/liquid-hover/moment.cssother457 B
assets/moments/liquid-hover/moment.jsscript13.1 KB
assets/moments/liquid-type/demo.htmlother3.0 KB
assets/moments/liquid-type/meta.jsonconfig1.0 KB
assets/moments/liquid-type/moment.cssother462 B
assets/moments/liquid-type/moment.jsscript4.1 KB
assets/moments/marquee-row/demo.htmlother4.3 KB
assets/moments/marquee-row/meta.jsonconfig867 B
assets/moments/marquee-row/moment.cssother2.0 KB
assets/moments/marquee-row/moment.jsscript2.4 KB
assets/moments/moments.jsscript6.0 KB
assets/moments/photo-chapters/demo.htmlother5.1 KB
assets/moments/photo-chapters/meta.jsonconfig1.8 KB
assets/moments/photo-chapters/moment.cssother6.2 KB
assets/moments/photo-chapters/moment.jsscript6.1 KB
assets/moments/picture-develops/demo-film.htmlother3.9 KB
assets/moments/picture-develops/demo.htmlother4.2 KB
assets/moments/picture-develops/meta.jsonconfig1.4 KB
assets/moments/picture-develops/moment.cssother1.9 KB
assets/moments/picture-develops/moment.jsscript9.2 KB
assets/moments/pinned-chapters/demo.htmlother5.4 KB
assets/moments/pinned-chapters/meta.jsonconfig1.3 KB
assets/moments/pinned-chapters/moment.cssother6.9 KB
assets/moments/pinned-chapters/moment.jsscript4.2 KB
assets/moments/window-parallax/demo.htmlother3.8 KB
assets/moments/window-parallax/meta.jsonconfig913 B
assets/moments/window-parallax/moment.cssother591 B
assets/moments/window-parallax/moment.jsscript1.2 KB
assets/moments/word-highlight/demo.htmlother4.5 KB
assets/moments/word-highlight/meta.jsonconfig1.0 KB
assets/moments/word-highlight/moment.cssother849 B
assets/moments/word-highlight/moment.jsscript2.0 KB
assets/moments/word-rotate/demo.htmlother4.5 KB
assets/moments/word-rotate/meta.jsonconfig948 B
assets/moments/word-rotate/moment.cssother906 B
assets/moments/word-rotate/moment.jsscript2.2 KB
assets/motion/_hover-test.htmlother1.4 KB
assets/motion/demo.htmlother34.1 KB
assets/motion/meta.jsonconfig2.7 KB
assets/motion/motion.cssother25.1 KB
assets/motion/motion.jsscript22.8 KB
assets/starter.htmlother34.2 KB
assets/system.cssother100.5 KB
assets/system.jsscript34.9 KB
assets/ui/_lab/build-index.mjsscript4.0 KB
assets/ui/_lab/loops.htmlother8.7 KB
assets/ui/_lab/object-card.htmlother4.7 KB
assets/ui/_lab/selftest.htmlother3.1 KB
assets/ui/apps/fragment.cssother3.0 KB
assets/ui/apps/fragment.htmlother2.3 KB
assets/ui/apps/fragment.jsscript2.0 KB
assets/ui/apps/meta.jsonconfig1.6 KB
assets/ui/base.cssother15.7 KB
assets/ui/calendar/fragment.cssother4.4 KB
assets/ui/calendar/fragment.htmlother3.4 KB
assets/ui/calendar/fragment.jsscript3.4 KB
assets/ui/calendar/meta.jsonconfig957 B
assets/ui/cards.cssother21.6 KB
assets/ui/cards.htmlother52.3 KB
assets/ui/chat/fragment.cssother3.9 KB
assets/ui/chat/fragment.htmlother5.0 KB
assets/ui/chat/fragment.jsscript2.9 KB
assets/ui/chat/meta.jsonconfig1.1 KB
assets/ui/checklist/fragment.cssother2.2 KB
assets/ui/checklist/fragment.htmlother1.3 KB
assets/ui/checklist/fragment.jsscript1.5 KB
assets/ui/checklist/meta.jsonconfig901 B
assets/ui/code/fragment.cssother2.6 KB
assets/ui/code/fragment.htmlother1.6 KB
assets/ui/code/fragment.jsscript1.7 KB
assets/ui/code/meta.jsonconfig857 B
assets/ui/cursor/fragment.cssother2.4 KB
assets/ui/cursor/fragment.htmlother1.7 KB
assets/ui/cursor/fragment.jsscript3.2 KB
assets/ui/cursor/meta.jsonconfig1.2 KB
assets/ui/diff-review/fragment.cssother13.9 KB
assets/ui/diff-review/fragment.htmlother4.9 KB
assets/ui/diff-review/fragment.jsscript2.4 KB
assets/ui/diff-review/meta.jsonconfig3.9 KB
assets/ui/doc/fragment.cssother2.4 KB
assets/ui/doc/fragment.htmlother1.2 KB
assets/ui/doc/fragment.jsscript3.2 KB
assets/ui/doc/meta.jsonconfig1.2 KB
assets/ui/files/fragment.cssother3.9 KB
assets/ui/files/fragment.htmlother3.3 KB
assets/ui/files/fragment.jsscript3.4 KB
assets/ui/files/meta.jsonconfig1.7 KB
assets/ui/icons/asana.svgother1004 B
assets/ui/icons/calendly.svgother1.8 KB
assets/ui/icons/confluence.svgother2.4 KB
assets/ui/icons/docker.svgother2.2 KB

assets/moments/liquid-hover/moment.js

View on GitHub
/*
  liquid-hover - the pointer pushes a photograph like the surface of water: wherever it moves, the
  picture is displaced along the pointer's direction with a wet shine and a hair of colour split, and
  the ripple diffuses and dies out within a second or two, back to the plain picture (the flow map is
  drained by a small dead zone each step, so an 8-bit residue never freezes a warp in the picture,
  and both flow buffers are cleared when the ripple is spent; decay and drain go by wall time, so a
  slow machine shows the same ripple for the same time). One WebGL context, mounted only while
  the frame is near the screen and freed when it leaves; the frame loop runs only while the ripple is
  alive. The photograph is shown plain on touch screens, under reduced motion, without WebGL and when
  the canvas-effect fails to compile.

    <figure class="frame frame--photo" data-moment="liquid-hover" data-moment-opts='{"strength": 0.7}'>
      <img src="…" alt="…" width="1800" height="1200">
    </figure>

  The host sets the size; the photograph fills it (cover). The picture must be readable by WebGL:
  same origin, or served with CORS and marked crossorigin="anonymous". It needs edges and detail (a
  coast, a building, a street): a flat sea or sky shows no ripple.
  opts: strength 0.1-1 (how far the picture is pushed, default 0.7), radius 0.05-0.3 (the brush,
        default 0.14), decay (how long a ripple lives, per 16.7 ms of wall time whatever the frame
        rate, 0.9-0.995, default 0.985: a ripple fades in a second or two).
*/
const VERT = 'attribute vec2 a_pos; varying vec2 v_uv; void main() { v_uv = a_pos * 0.5 + 0.5; gl_Position = vec4(a_pos, 0.0, 1.0); }';
// the flow map: a 2-channel vector field stored around 0.5 in 8 bits; each frame it diffuses, decays,
// loses a dead zone of 1.5 levels (so a stored value within a level of the centre drains to zero) and
// takes the pointer's velocity under a gaussian brush
const FLOW = `precision mediump float; varying vec2 v_uv;
uniform sampler2D u_prev; uniform vec2 u_pointer; uniform vec2 u_vel; uniform float u_decay; uniform float u_drain; uniform float u_radius; uniform vec2 u_texel; uniform float u_aspect;
void main() {
  vec4 c = texture2D(u_prev, v_uv);
  vec4 n = texture2D(u_prev, v_uv + vec2(u_texel.x, 0.0)) + texture2D(u_prev, v_uv - vec2(u_texel.x, 0.0)) + texture2D(u_prev, v_uv + vec2(0.0, u_texel.y)) + texture2D(u_prev, v_uv - vec2(0.0, u_texel.y));
  vec2 enc = mix(c.xy, n.xy * 0.25, 0.42);
  vec2 fl = (enc - 0.5) * 2.0 * u_decay;
  fl = sign(fl) * max(abs(fl) - vec2(u_drain), vec2(0.0));
  vec2 d = (v_uv - u_pointer) * vec2(u_aspect, 1.0);
  float g = exp(-dot(d, d) / (u_radius * u_radius));
  fl += u_vel * g;
  fl = clamp(fl, -1.0, 1.0);
  gl_FragColor = vec4(fl * 0.5 + 0.5, 0.0, 1.0);
}`;
// the picture, displaced by the flow (the same dead zone, so a resting map draws the plain picture),
// with a hair of colour split along the push and a wet shine: the slope of the flow's strength is
// lit from the upper left, so a ripple has a bright crest and a shaded trough like water does
const DRAW = `precision mediump float; varying vec2 v_uv;
uniform sampler2D u_img; uniform sampler2D u_flow; uniform vec2 u_cover; uniform float u_amp; uniform vec2 u_ftex;
vec2 flow(vec2 p) { vec2 f = (texture2D(u_flow, p).xy - 0.5) * 2.0; return sign(f) * max(abs(f) - vec2(1.5 / 255.0), vec2(0.0)); }
void main() {
  vec2 fl = flow(v_uv);
  float m = length(fl);
  float sx = length(flow(v_uv + vec2(u_ftex.x, 0.0))) - length(flow(v_uv - vec2(u_ftex.x, 0.0)));
  float sy = length(flow(v_uv + vec2(0.0, u_ftex.y))) - length(flow(v_uv - vec2(0.0, u_ftex.y)));
  float shine = clamp((sy - sx) * 2.5, -0.12, 0.28);
  vec2 uv = (v_uv - 0.5) * u_cover + 0.5;
  vec2 o = fl * u_amp;
  vec3 col;
  col.r = texture2D(u_img, uv - o * 1.01).r;
  col.g = texture2D(u_img, uv - o).g;
  col.b = texture2D(u_img, uv - o * 0.99).b;
  col += shine + smoothstep(0.03, 0.5, m) * 0.06;
  gl_FragColor = vec4(col, 1.0);
}`;
const FS = 128;

export default function (root, opts, lib) {
  const img = root.querySelector('img');
  if (!img) return {};
  root.classList.add('mo-lq');
  if (lib.reduced() || lib.coarse() || root.dataset.momentOff != null) return {};
  const amp = 0.2 * lib.clamp(+opts.strength || 0.7, 0.1, 1);
  const radius = lib.clamp(+opts.radius || 0.14, 0.05, 0.3);
  const decay = lib.clamp(+opts.decay || 0.985, 0.9, 0.995);
  let canvas = null, gl = null, progFlow = null, progDraw = null, tex = null, fbo = [], raf = 0, near = false, dead = false, energy = 0, ping = 0, freeTimer = 0, lastT = 0;
  const pt = { x: 0.5, y: 0.5, vx: 0, vy: 0, has: false };
  // the page's one count of live WebGL contexts (window.__tpGl, at most __tpGlMax or 4): refused, the photograph stays as it is
  const tpMax = () => window.__tpGlMax || 4;
  let held = false;
  const take = () => { const n = window.__tpGl || 0; if (n >= tpMax()) return false; window.__tpGl = n + 1; held = true; return true; };
  const give = () => { if (held) { window.__tpGl = Math.max(0, (window.__tpGl || 0) - 1); held = false; } };
  const fail = why => { give(); if (canvas) { try { gl?.getExtension('WEBGL_lose_context')?.loseContext(); } catch { /* gone */ } canvas.remove(); } canvas = gl = null; fbo = []; root.dataset.momentFallback = why; dead = true; };

  const compile = (type, src) => { const s = gl.createShader(type); gl.shaderSource(s, src); gl.compileShader(s); if (!gl.getShaderParameter(s, gl.COMPILE_STATUS)) throw new Error(gl.getShaderInfoLog(s) || 'canvas-effect'); return s; };
  const program = frag => { const p = gl.createProgram(); gl.attachShader(p, compile(gl.VERTEX_SHADER, VERT)); gl.attachShader(p, compile(gl.FRAGMENT_SHADER, frag)); gl.bindAttribLocation(p, 0, 'a_pos'); gl.linkProgram(p); if (!gl.getProgramParameter(p, gl.LINK_STATUS)) throw new Error(gl.getProgramInfoLog(p) || 'link'); return p; };
  const target = () => {
    const t = gl.createTexture();
    gl.bindTexture(gl.TEXTURE_2D, t);
    gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, FS, FS, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
    gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
    const f = gl.createFramebuffer();
    gl.bindFramebuffer(gl.FRAMEBUFFER, f);
    gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, t, 0);
    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
    return { t, f };
  };
  // both flow buffers to the centre value: no flow anywhere
  const clear = () => {
    if (!gl) return;
    gl.clearColor(0.5, 0.5, 0, 1);
    for (const { f } of fbo) { gl.bindFramebuffer(gl.FRAMEBUFFER, f); gl.clear(gl.COLOR_BUFFER_BIT); }
    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
  };
  const size = () => {
    const w = root.clientWidth, h = root.clientHeight;
    const dpr = Math.min(devicePixelRatio || 1, 1.5);
    const cap = Math.sqrt(1.2e6 / Math.max(1, w * h));          // about 1.2 megapixels at most
    const s = Math.min(dpr, cap);
    canvas.width = Math.max(2, Math.round(w * s)); canvas.height = Math.max(2, Math.round(h * s));
  };
  const mount = () => {
    if (dead || canvas || !img.naturalWidth) return;
    if (!take()) return;
    canvas = document.createElement('canvas');
    canvas.className = 'mo-lq__gl';
    canvas.setAttribute('aria-hidden', 'true');
    const attrs = { alpha: false, antialias: false, depth: false, stencil: false, preserveDrawingBuffer: false, powerPreference: 'low-power' };
    gl = canvas.getContext('webgl', attrs) || canvas.getContext('experimental-webgl', attrs);
    if (!gl) return fail('no-webgl');
    try {
      progFlow = program(FLOW); progDraw = program(DRAW);
      const buf = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, buf);
      gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([-1, -1, 3, -1, -1, 3]), gl.STATIC_DRAW);
      gl.enableVertexAttribArray(0); gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
      tex = gl.createTexture();
      gl.bindTexture(gl.TEXTURE_2D, tex);
      gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
      gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB, gl.RGB, gl.UNSIGNED_BYTE, img);
      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
      gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
      gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, false);
      if (gl.getError() !== gl.NO_ERROR) throw new Error('texture');
      fbo = [target(), target()];
      clear();
    } catch (e) { console.warn('liquid-hover:', e.message); return fail('canvas-effect-error'); }
    size();
    canvas.addEventListener('webglcontextlost', e => { e.preventDefault(); free(); }, { once: true });
    root.append(canvas);
    draw();
  };
  const free = () => { give(); if (!canvas) return; try { gl.getExtension('WEBGL_lose_context')?.loseContext(); } catch { /* gone */ } canvas.remove(); canvas = gl = null; fbo = []; if (raf) cancelAnimationFrame(raf); raf = 0; energy = 0; };
  const u = (p, n) => gl.getUniformLocation(p, n);
  const draw = () => {
    if (!gl) return;
    const ca = canvas.width / canvas.height, ia = img.naturalWidth / img.naturalHeight;
    // the decay and the drain are per 16.7 ms of wall time, not per frame, so a ripple lives about a
    // second on a slow machine too (a dropped frame decays as the frames it stood for, 6 at most)
    const now = performance.now(), frames = lastT ? Math.min(6, Math.max(0.25, (now - lastT) / 16.67)) : 1;
    lastT = now;
    const decayF = Math.pow(decay, frames), drain = Math.min(0.04, 1 / 255 * frames);
    // the flow step
    gl.useProgram(progFlow);
    gl.viewport(0, 0, FS, FS);
    gl.bindFramebuffer(gl.FRAMEBUFFER, fbo[1 - ping].f);
    gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, fbo[ping].t);
    gl.uniform1i(u(progFlow, 'u_prev'), 0);
    gl.uniform2f(u(progFlow, 'u_pointer'), pt.x, pt.y);
    gl.uniform2f(u(progFlow, 'u_vel'), pt.vx, pt.vy);
    gl.uniform1f(u(progFlow, 'u_decay'), decayF);
    gl.uniform1f(u(progFlow, 'u_drain'), drain);
    gl.uniform1f(u(progFlow, 'u_radius'), radius);
    gl.uniform2f(u(progFlow, 'u_texel'), 1 / FS, 1 / FS);
    gl.uniform1f(u(progFlow, 'u_aspect'), ca);
    gl.drawArrays(gl.TRIANGLES, 0, 3);
    ping = 1 - ping;
    // the picture
    gl.useProgram(progDraw);
    gl.bindFramebuffer(gl.FRAMEBUFFER, null);
    gl.viewport(0, 0, canvas.width, canvas.height);
    gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, tex);
    gl.activeTexture(gl.TEXTURE1); gl.bindTexture(gl.TEXTURE_2D, fbo[ping].t);
    gl.uniform1i(u(progDraw, 'u_img'), 0);
    gl.uniform1i(u(progDraw, 'u_flow'), 1);
    gl.uniform2f(u(progDraw, 'u_cover'), ia > ca ? ca / ia : 1, ia > ca ? 1 : ia / ca);
    gl.uniform1f(u(progDraw, 'u_amp'), amp);
    gl.uniform2f(u(progDraw, 'u_ftex'), 1 / FS, 1 / FS);
    gl.drawArrays(gl.TRIANGLES, 0, 3);
    // the strongest flow the map can still hold: what this frame injected plus what was there, decayed
    // and drained exactly as the canvas-effect does it (diffusion only lowers it further), so the loop stops
    // only once the map is really empty. The pointer's push is spent over a few frames whatever the
    // frame rate, so a slow machine injects the same push in fewer, larger steps.
    energy = Math.min(1, Math.max(0, energy * decayF - drain) + Math.hypot(pt.vx, pt.vy));
    pt.vx *= 0.55; pt.vy *= 0.55;
  };
  const loop = () => {
    raf = 0;
    if (!gl || !near || document.hidden) return;
    draw();
    if (energy > 0) raf = requestAnimationFrame(loop);
    else { pt.vx = pt.vy = 0; clear(); draw(); energy = 0; lastT = 0; }   // the ripple spent: no flow, the plain picture
  };
  const wake = () => { if (!raf && gl && near) { if (!energy) lastT = 0; raf = requestAnimationFrame(loop); } };
  const move = e => {
    const r = root.getBoundingClientRect();
    const x = (e.clientX - r.left) / r.width, y = 1 - (e.clientY - r.top) / r.height;
    if (pt.has) { pt.vx = lib.clamp(pt.vx + (x - pt.x) * 4.0, -1, 1); pt.vy = lib.clamp(pt.vy + (y - pt.y) * 4.0, -1, 1); }
    pt.x = x; pt.y = y; pt.has = true;
    wake();
  };
  const leave = () => { pt.has = false; };
  const io = new IntersectionObserver(es => {
    near = es[es.length - 1].isIntersecting;
    clearTimeout(freeTimer);
    if (near) { if (img.complete && img.naturalWidth) mount(); else img.addEventListener('load', mount, { once: true }); wake(); }
    else freeTimer = setTimeout(free, 4000);
  }, { rootMargin: '20% 0px' });
  io.observe(root);
  const ro = new ResizeObserver(() => { if (canvas) { size(); draw(); } });
  ro.observe(root);
  root.addEventListener('pointermove', move, { passive: true });
  root.addEventListener('pointerleave', leave);
  const vis = () => { if (!document.hidden) wake(); };
  document.addEventListener('visibilitychange', vis);
  return { destroy() { io.disconnect(); ro.disconnect(); clearTimeout(freeTimer); root.removeEventListener('pointermove', move); root.removeEventListener('pointerleave', leave); document.removeEventListener('visibilitychange', vis); free(); } };
}
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 323kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall