Cyberpunk Neon Login V2

A login form on a neon sign in the rain. The tubes flicker to life, a wrong password tears the sign apart in red with sparks bouncing on the wet street, and the right one sends a surge of light through every tube.

Type any name and a wrong password, press Enter, then try the password neon.

Download

What you can change

Change a number, save, and reload the page to see the difference.

FLICKER[1,0,1,1,0,1]

The on and off pattern a tube plays while it ignites, one step per frame.

GLITCH14

How far the sign tears sideways on a wrong password, in pixels.

RAIN200

How many rain streaks fall. 0 turns the rain off.

MAGENTA, CYAN, GREEN, REDrgb arrays

The neon colors of the frame, the fields, success and error.

Add it to your site

A game or esports landing, a nightlife or music site, a dev tool with a dark brand, any sign in page that should feel like a movie.

  1. CSS

    Paste into your stylesheet, or inside a <style> tag in <head>.

    .nl { position: relative; width: min(540px, 100vw); aspect-ratio: 540 / 500; margin: 0; overflow: hidden; background: #06030E; }
    .nl canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
    /* real inputs sit invisibly over the neon tubes, so typing, paste and password managers keep working */
    .nl input { position: absolute; left: 18.52%; width: 62.96%; height: 8.8%; box-sizing: border-box; border: 0; border-radius: 12px; outline: none;
      padding: 0 20px; background: transparent; color: transparent; caret-color: transparent; font-size: 16px; }
    .nl .nl-user { top: 23.2%; }
    .nl .nl-pass { top: 34.8%; }
    .nl input:focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
    .nl button { position: absolute; left: 32.59%; top: 47.2%; width: 34.81%; height: 6.8%; border: 0; border-radius: 999px; background: transparent; cursor: pointer; }
    .nl button:focus-visible { box-shadow: 0 0 0 2px rgba(255,255,255,.4); }
    .nl-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .nl-hint { margin: 14px 0 0; text-align: center; font: 14px/1.4 system-ui, sans-serif; color: #7C7090; }
    .nl-hint b { color: #E9DDF7; }
  2. HTML

    Put it where the effect should appear on your page.

    <div>
      <form class="nl" id="nl" novalidate>
        <canvas aria-hidden="true"></canvas>
        <input class="nl-user" id="nl-user" type="text" autocomplete="username" aria-label="Username" spellcheck="false" maxlength="18">
        <input class="nl-pass" id="nl-pass" type="password" autocomplete="current-password" aria-label="Password" maxlength="14">
        <button type="submit" aria-label="Enter">
        </button>
        <p class="nl-sr" id="nl-status" role="status"></p>
      </form>
      <p class="nl-hint">Try any password, then <b>neon</b>.</p>
    </div>
  3. JavaScript

    Paste right before the closing </body> tag, inside <script></script>.

    const FLICKER = [1,0,1,1,0,1], GLITCH = 14;
    const MAGENTA = [255, 43, 214], CYAN = [32, 240, 255], GREEN = [60, 255, 190], RED = [255, 46, 77], SPARK = [255, 190, 120];
    const RAIN = 200;
    
    const form = document.getElementById('nl'), user = document.getElementById('nl-user'), pass = document.getElementById('nl-pass');
    const status = document.getElementById('nl-status');
    const view = form.querySelector('canvas'), out = view.getContext('2d');
    const reduce = matchMedia('(prefers-reduced-motion: reduce)').matches;
    const clamp = (x, a = 0, b = 1) => Math.min(b, Math.max(a, x));
    const lerp = (a, b, k) => a + (b - a) * k;
    const mix = (a, b, k) => a.map((v, i) => Math.round(lerp(v, b[i], k)));
    const rgba = (c, a) => `rgba(${c[0]},${c[1]},${c[2]},${a})`;
    const hash = n => { const s = Math.sin(n * 127.1 + 311.7) * 43758.5453; return s - Math.floor(s); };
    const wait = ms => new Promise(r => setTimeout(r, ms));
    const round = (g, x, y, w, h, r) => { g.beginPath(); g.roundRect(x, y, w, h, r); };
    
    // the sign is laid out in a 540 × 500 box, FLOOR is where the wet street starts
    const W = 540, H = 500, FLOOR = 320;
    const neon = document.createElement('canvas'), neonCtx = neon.getContext('2d');
    const glowCanvas = document.createElement('canvas'), glow = glowCanvas.getContext('2d');
    let now = performance.now() / 1000, k = 1;
    
    // ── tubes: every piece of the sign lights up on its own
    const tubes = {
      frame: { start: .06, on: 0, path: g => round(g, 58, 44, 424, 240, 26), fixed: MAGENTA },
      head: { start: .2, on: 0, text: 'SIGN IN' },
      user: { start: .3, on: 0, path: g => round(g, 100, 116, 340, 44, 12) },
      pass: { start: .38, on: 0, path: g => round(g, 100, 174, 340, 44, 12) },
      btn: { start: .5, on: 0, path: g => round(g, 176, 236, 188, 34, 17), fixed: MAGENTA },
      color: CYAN, from: CYAN, colorAt: -9, surgeAt: -9,
      set(color) {
        this.from = this.now(); this.color = color; this.colorAt = now;
        this.head.text = color === RED ? 'ACCESS DENIED' : color === GREEN ? 'ACCESS GRANTED' : 'SIGN IN';
        this.head.start = now;
        if (color === GREEN) this.surgeAt = now;
      },
      now() { return mix(this.from, this.color, clamp((now - this.colorAt) / .12)); },
    };
    const t0 = now;
    for (const name of ['frame', 'head', 'user', 'pass', 'btn']) tubes[name].start += t0;
    
    function ignite(tube, t) {
      const i = Math.floor(t * 30) % 6;
      tube.on = t > 0.5 ? 1 : FLICKER[i];
    }
    
    let glitchAt = -9, glitchAmount = 0, pressAt = -9, sparkList = [];
    function glitch(amount) { glitchAmount = reduce ? 0 : amount; glitchAt = now; }
    function sparks(n) {
      if (reduce) return;
      for (let i = 0; i < n; i++) {
        const ang = -Math.PI / 2 + (Math.random() - .5) * 2.6, sp = 180 + 260 * Math.random();
        sparkList.push({ born: now + Math.random() * .06, x0: 270 + (Math.random() - .5) * 150, y0: 253, vx: Math.cos(ang) * sp, vy: Math.sin(ang) * sp, life: .7 + .5 * Math.random(), w: 1.6 + Math.random() });
      }
    }
    
    // ── the check. Replace the body with your real request
    async function check(password) {
      await wait(300);
      return password === 'neon';   // demo only, ask your server instead
    }
    
    let busy = false;
    form.addEventListener('submit', async e => {
      e.preventDefault();
      if (busy) return;
      busy = true; pressAt = now;
      const password = pass.value;
      if (await check(password)) tubes.set(GREEN);
      else tubes.set(RED), glitch(GLITCH), sparks(24);
      if (tubes.color === GREEN) { status.textContent = 'Access granted'; user.disabled = pass.disabled = true; return; }
      status.textContent = 'Access denied';
      await wait(1000);
      pass.value = ''; tubes.set(CYAN); busy = false; pass.focus();
    });
    
    // ── drawing
    function tube(g, path, color, on, hot) {
      if (on <= 0) return;
      const core = mix(color, [255, 255, 255], .62 + .3 * hot);
      g.save(); g.lineCap = g.lineJoin = 'round';
      path(g); g.strokeStyle = rgba(color, .35 * on); g.lineWidth = 8; g.stroke();
      path(g); g.strokeStyle = rgba(color, .95 * on); g.lineWidth = 3.6; g.stroke();
      path(g); g.strokeStyle = rgba(core, on); g.lineWidth = 1.5; g.stroke();
      g.restore();
    }
    
    function drawNeon(g) {
      g.setTransform(k, 0, 0, k, 0, 0); g.clearRect(0, 0, W, H);
      const color = tubes.now(), hot = Math.exp(-(now - tubes.surgeAt) * 5);
      const offFlicker = now - glitchAt < .3 ? FLICKER[Math.floor((now - glitchAt) * 30) % 6] : 1;
      const tint = c => tubes.color === RED ? mix(c, RED, clamp((now - tubes.colorAt) / .12)) : c;
      tube(g, tubes.frame.path, tint(MAGENTA), tubes.frame.on * offFlicker, hot);
      g.save(); g.font = `800 ${tubes.head.text === 'SIGN IN' ? 28 : 25}px system-ui, sans-serif`; g.letterSpacing = '4px'; g.textAlign = 'center'; g.textBaseline = 'middle'; g.lineJoin = 'round';
      for (const [a, w, c] of [[.3, 3.4, color], [.95, 1.5, color], [1, .6, mix(color, [255, 255, 255], .62 + .3 * hot)]]) {
        g.strokeStyle = rgba(c, a * tubes.head.on * offFlicker); g.lineWidth = w; g.strokeText(tubes.head.text, 270, 82);
      }
      g.restore();
      tube(g, tubes.user.path, color, tubes.user.on * offFlicker, hot);
      tube(g, tubes.pass.path, color, tubes.pass.on * offFlicker, hot);
      const press = now - pressAt < .18;
      tube(g, tubes.btn.path, tint(MAGENTA), tubes.btn.on * offFlicker, hot + (press ? .8 : 0));
      if (press) { tubes.btn.path(g); g.fillStyle = rgba(tint(MAGENTA), .35); g.fill(); }
      g.save(); g.font = '800 15px system-ui, sans-serif'; g.letterSpacing = '5px'; g.textAlign = 'center'; g.textBaseline = 'middle';
      g.fillStyle = rgba(mix(tint(MAGENTA), [255, 255, 255], .75), tubes.btn.on * offFlicker); g.fillText('ENTER', 272, 254); g.restore();
    
      // what was typed, in neon
      const bright = rgba(mix(color, [255, 255, 255], .7), offFlicker);
      g.save(); g.textBaseline = 'middle'; g.textAlign = 'left'; g.font = '600 19px system-ui, sans-serif';
      g.fillStyle = user.value ? bright : rgba(color, .35 * tubes.user.on);
      g.fillText(user.value || 'username', 120, 139);
      const dots = Math.min(pass.value.length, 15);
      g.fillStyle = bright;
      for (let i = 0; i < dots; i++) { g.beginPath(); g.arc(126 + i * 20, 196, 4.2, 0, 7); g.fill(); }
      if (!dots) { g.fillStyle = rgba(color, .35 * tubes.pass.on); g.fillText('password', 120, 197); }
      if (Math.floor(now * 2.6) % 2 === 0) {
        g.fillStyle = rgba(color, .95);
        if (document.activeElement === user) g.fillRect(122 + (user.value ? g.measureText(user.value).width + 2 : 0), 129, 2, 20);
        if (document.activeElement === pass) g.fillRect(118 + dots * 20, 186, 2, 20);
      }
      g.restore();
    
      // sparks with one bounce on the wet floor
      g.save(); g.lineCap = 'round';
      sparkList = sparkList.filter(p => now - p.born < p.life);
      for (const p of sparkList) {
        const s = now - p.born; if (s < 0) continue;
        const G = 1300, tHit = (-p.vy + Math.sqrt(p.vy * p.vy + 2 * G * (FLOOR - p.y0))) / G;
        let x = p.x0 + p.vx * s, y = p.y0 + p.vy * s + G * s * s / 2, vy = p.vy + G * s;
        if (s > tHit) { const s2 = s - tHit, vb = -(p.vy + G * tHit) * .32; y = Math.min(FLOOR, FLOOR + vb * s2 + G * s2 * s2 / 2); vy = vb + G * s2; }
        g.strokeStyle = rgba(mix(SPARK, [255, 255, 255], .5), 1 - s / p.life); g.lineWidth = p.w;
        g.beginPath(); g.moveTo(x - p.vx * .018, y - vy * .018); g.lineTo(x, y); g.stroke();
      }
      g.restore();
    }
    
    function frame() {
      now = performance.now() / 1000;
      const dpr = Math.min(2, devicePixelRatio || 1), cw = Math.round(form.clientWidth * dpr), ch = Math.round(form.clientHeight * dpr);
      if (view.width !== cw || view.height !== ch) { view.width = neon.width = glowCanvas.width = cw; view.height = neon.height = glowCanvas.height = ch; }
      k = cw / W;
      for (const name of ['frame', 'head', 'user', 'pass', 'btn']) {
        const tb = tubes[name];
        if (reduce) tb.on = now >= tb.start ? 1 : 0;
        else if (now < tb.start) tb.on = 0;
        else ignite(tb, now - tb.start);
      }
      drawNeon(neonCtx);
    
      glow.clearRect(0, 0, cw, ch);
      glow.filter = 'blur(12px)'; // bloom
      glow.drawImage(neon, 0, 0);
      glow.filter = 'none';
    
      // night, far city and bokeh
      const tt = now - t0, g = out;
      g.setTransform(k, 0, 0, k, 0, 0);
      const sky = g.createLinearGradient(0, 0, 0, H); sky.addColorStop(0, '#06030E'); sky.addColorStop(.6, '#0B0619'); sky.addColorStop(1, '#040208');
      g.fillStyle = sky; g.fillRect(0, 0, W, H);
      for (let i = 0; i < 9; i++) {
        const x = -20 + i * 66 + hash(i) * 20, w = 46 + hash(i + 1) * 40, h = 120 + hash(i + 2) * 190;
        g.fillStyle = '#0A0716'; g.fillRect(x, FLOOR - h, w, h);
      }
      for (let i = 0; i < 30; i++) {
        const x = hash(i + 40) * W, y = hash(i + 41) * 300, r = 8 + hash(i + 42) * 26, c = hash(i + 43) > .5 ? MAGENTA : CYAN;
        const bg = g.createRadialGradient(x, y, 0, x, y, r); bg.addColorStop(0, rgba(c, .1 + .06 * Math.sin(tt * .8 + i))); bg.addColorStop(1, rgba(c, 0));
        g.fillStyle = bg; g.fillRect(x - r, y - r, r * 2, r * 2);
      }
      round(g, 46, 34, 448, 262, 30); g.fillStyle = 'rgba(8,5,16,.86)'; g.fill();
      g.save(); g.lineCap = g.lineJoin = 'round'; g.strokeStyle = 'rgba(140,120,170,.16)'; g.lineWidth = 3.6;
      for (const name of ['frame', 'user', 'pass', 'btn']) { tubes[name].path(g); g.stroke(); }
      g.restore();
    
      // the neon, torn into slices and split into colors while it glitches
      g.setTransform(1, 0, 0, 1, 0, 0);
      const gl = glitchAmount * Math.exp(-(now - glitchAt) * 3.2) * (now - glitchAt < .6 ? 1 : 0) * k;
      const shake = gl * .4, sx = shake * Math.sin(now * 90), sy = shake * Math.cos(now * 73);
      g.save(); g.globalCompositeOperation = 'lighter';
      if (gl > .5) {
        g.globalAlpha = .55; g.drawImage(neon, gl * .45 + sx, sy); g.drawImage(neon, -gl * .45 + sx, sy);
        g.globalAlpha = 1;
        const band = Math.round(16 * k), top = Math.round(40 * k);
        for (let y = top; y < 290 * k; y += band) g.drawImage(neon, 0, y, cw, band, (hash(y + Math.floor(now * 24)) - .5) * 2 * gl + sx, y + sy, cw, band);
        const low = Math.round(290 * k); g.drawImage(neon, 0, low, cw, ch - low, sx, low + sy, cw, ch - low);   // sparks below the sign stay whole
      } else g.drawImage(neon, 0, 0);
      const surge = Math.exp(-(now - tubes.surgeAt) * 5);
      g.globalAlpha = clamp(.9 + surge); g.drawImage(glowCanvas, sx, sy); g.drawImage(glowCanvas, sx, sy);
      g.globalAlpha = 1;
      g.restore();
    
      // wet floor with a short rippled reflection
      g.setTransform(k, 0, 0, k, 0, 0);
      const fg = g.createLinearGradient(0, FLOOR, 0, H); fg.addColorStop(0, '#0A0614'); fg.addColorStop(1, '#030206');
      g.fillStyle = fg; g.fillRect(0, FLOOR, W, H - FLOOR);
      g.save(); g.setTransform(1, 0, 0, 1, 0, 0); g.globalCompositeOperation = 'lighter';
      for (let y = FLOOR; y < FLOOR + 80; y += 6) {
        const src = (2 * FLOOR - y - 6) * k, fade = Math.pow(clamp(1 - (y - FLOOR) / 80), 1.6), rip = (reduce ? 0 : Math.sin(y * .16 + tt * 5) * (2 + (y - FLOOR) * .02)) * k;
        g.globalAlpha = .42 * fade; g.drawImage(neon, 0, src, cw, 6 * k, rip, y * k, cw, 6 * k);
      }
      g.restore();
    
      // rain
      g.save(); g.globalCompositeOperation = 'lighter'; g.lineCap = 'round';
      for (let i = 0; i < RAIN; i++) {
        const speed = 1100 + 500 * hash(i + 300), len = 14 + hash(i + 301) * 16, x = hash(i + 302) * (W + 60) - 30;
        const y = reduce ? hash(i + 303) * H : ((hash(i + 303) * (H + 100) + tt * speed) % (H + 100)) - 60;
        g.strokeStyle = `rgba(170,200,255,${.1 + .16 * hash(i + 304)})`; g.lineWidth = .8 + hash(i + 305) * .8;
        g.beginPath(); g.moveTo(x, y); g.lineTo(x - len * .12, y + len); g.stroke();
      }
      g.restore();
    
      const vg = g.createRadialGradient(270, 180, 140, 270, 220, 460); vg.addColorStop(0, 'rgba(0,0,0,0)'); vg.addColorStop(1, 'rgba(0,0,0,.65)');
      g.fillStyle = vg; g.fillRect(0, 0, W, H);
      requestAnimationFrame(frame);
    }
    requestAnimationFrame(frame);

Connect it to your backend

Put your request inside check() and return true when the server accepts the login. Delete the demo line that accepts the password neon.

Good to know

Tilda, Webflow, WordPress

Press Copy all code at the top and paste it into one HTML block.

Tilda

Add block, Other, T123 HTML code. Paste and save. Check the published page, the editor preview does not run scripts.

Webflow

Add panel, Embed. Paste, then Save & Close. Custom code runs on the published site.

WordPress

Add block, Custom HTML. Paste and press Update.

More in Sign in & forms

See all
Copied