全部效果静态视觉样式

套色错位印刷

Offset Print Misregistration

多块油墨版轻微错开,图案边沿露出不同颜色,重叠区域呈现更深的混合色。

拖动滑块观察效果变化

适用场景

适用于海报、专辑封面或图形标记,营造仿手工套印的质地。 选择轮廓清楚的大图案,错开一小段就能露出套印色边,同时保留图形原有形状。

应用示例

一家独立唱片厂牌在新专辑页面放了一张双色麦克风插画。青色墨版横移几像素露出色边,两色重叠处变深,曲目列表依然用对齐的实心字排版。

AI 提示词

为【图形】制作套色错位。在浅色纸张上绘制各自着色的油墨版,将它们沿不同轴偏移,并用正片叠底混出重叠颜色。文字和无障碍文本使用单独的对齐图层。

示例代码

保存为 HTML 文件后,用浏览器打开即可运行。代码与页面里的演示一致。

查看 HTML
<!doctype html>
<html lang="zh">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>套色错位印刷</title>
  <style>
    :root {
      color-scheme: dark;
      --demo-bg: #171629;
      --demo-ink: #f8f5ff;
      --demo-accent: #b9a6ff;
      --demo-muted: #bfbbd3;
      font-family: system-ui, sans-serif;
      color: var(--demo-ink);
      background: var(--demo-bg);
    }

    *, *::before, *::after { box-sizing: border-box; }
    body { margin: 0; min-width: 0; }
    button, input { font: inherit; }

    .demo {
      display: grid;
      place-items: center;
      align-content: center;
      min-height: 100vh;
      padding: 14px;
      overflow: hidden;
      background: radial-gradient(ellipse at 50% 24%, #28233f, var(--demo-bg) 78%);
    }

    .demo-button {
      border: 1px solid #ffffff3d;
      border-radius: 7px;
      background: #ffffff12;
      color: var(--demo-ink);
      padding: 6px 11px;
      font-size: 12px;
      cursor: pointer;
    }

    :focus-visible {
      outline: 2px solid var(--demo-accent);
      outline-offset: 3px;
    }

    .specimen {
      display: grid;
      width: min(100%, 356px);
      gap: 8px;
      margin: 0;
      justify-items: center;
    }
    .specimen canvas {
      display: block;
      width: 100%;
      aspect-ratio: 2;
      max-height: max(72px, calc(100vh - 65px));
      border-radius: 11px;
      background: linear-gradient(145deg, #232943, #14172c);
      box-shadow: 0 8px 22px #090a16a8;
    }
    .specimen label {
      display: grid;
      width: 100%;
      min-height: 25px;
      grid-template-columns: minmax(0, auto) minmax(56px, 1fr);
      align-items: center;
      gap: 8px;
      color: var(--demo-ink);
      font-size: 12px;
    }
    .specimen input {
      width: 100%;
      margin: 0;
      accent-color: #b9a6ff;
    }
    @media (prefers-reduced-motion: reduce) {
      .specimen [data-loop-toggle] { display: none; }
    }
  </style>
</head>
<body>
  <main class="demo">
    <figure class="specimen">
      <canvas role="img" aria-label="套色错位印刷" width="288" height="144">套色错位印刷</canvas>
      <label for="specimen-setting">色版偏移<input id="specimen-setting" type="range" min="0" max="100" value="65"></label>
    </figure>
  </main>
  <script>
    (() => {
      const canvas = document.querySelector('.specimen canvas');
      const ctx = canvas.getContext('2d');
      if (!ctx) {
        document.querySelector('.specimen :is(input, button)').disabled = true;
        return;
      }
      const width = 288;
      const height = 144;
      const turn = Math.PI * 2;
      let elapsed = 0;
      let variation = 0.65;

      function dot(x, y, radius, ink) {
        ctx.fillStyle = ink;
        ctx.beginPath();
        ctx.arc(x, y, radius, 0, turn);
        ctx.fill();
      }

      function mix(a, b, amount) {
        return a + (b - a) * amount;
      }


      function plate(x, y, ink) {
        ctx.save();
        ctx.translate(x, y);
        ctx.fillStyle = ink;
        ctx.beginPath();
        ctx.moveTo(-40, -18);
        ctx.lineTo(-22, -44);
        ctx.lineTo(27, -42);
        ctx.lineTo(47, -9);
        ctx.lineTo(32, 32);
        ctx.lineTo(-12, 42);
        ctx.lineTo(-43, 18);
        ctx.closePath();
        ctx.moveTo(19, 0);
        ctx.arc(1, 0, 18, 0, turn);
        ctx.fill('evenodd');
        ctx.restore();
      }

      function draw(_time, amount) {
        ctx.fillStyle = '#f0e7d6';
        ctx.fillRect(0, 0, width, height);
        ctx.strokeStyle = '#6f675f42';
        for (const x of [28, 260]) {
          for (const y of [23, 121]) {
            ctx.beginPath();
            ctx.moveTo(x - 5, y);
            ctx.lineTo(x + 5, y);
            ctx.moveTo(x, y - 5);
            ctx.lineTo(x, y + 5);
            ctx.stroke();
          }
        }
        ctx.globalCompositeOperation = 'multiply';
        const drift = amount * 19;
        plate(144 - drift, 72 - drift * .33, '#63baca');
        plate(144 + drift * .86, 72 + drift * .48, '#e57597');
        plate(144 - drift * .16, 72 + drift * .91, '#efcb52');
        ctx.globalCompositeOperation = 'source-over';
        dot(144 + drift * .28, 72, 3, '#332d43');
      }

      function render() {
        const ratio = Math.min(devicePixelRatio || 1, 2);
        const pixelsWide = Math.max(1, Math.round(canvas.clientWidth * ratio));
        const pixelsTall = Math.max(1, Math.round(canvas.clientHeight * ratio));
        if (canvas.width !== pixelsWide || canvas.height !== pixelsTall) {
          canvas.width = pixelsWide;
          canvas.height = pixelsTall;
        }
        ctx.setTransform(pixelsWide / width, 0, 0, pixelsTall / height, 0, 0);
        ctx.clearRect(0, 0, width, height);
        ctx.save();
        draw(elapsed, variation);
        ctx.restore();
      }

      render();
      new ResizeObserver(render).observe(canvas);

      const input = document.querySelector('#specimen-setting');
      input.addEventListener('input', () => {
        variation = Number(input.value) / 100;
        render();
      });
    })();
  </script>
</body>
</html>

UI Skills 原创示例

相关参考