Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

2.2 KB
Raw Blame
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 220" width="640" height="220" role="img">
  <style>
    .t { font-family: ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif; }
    .h { fill: #cbd0db; font-size: 13px; font-weight: 600; }
    .n { fill: #8b91a0; font-size: 11px; }
    .bad { fill: #e8615f; font-size: 11px; font-weight: 600; }
    .good { fill: #54c479; font-size: 11px; font-weight: 600; }
  </style>
  <defs>
    <clipPath id="boxClip"><rect x="238" y="46" width="110" height="110"/></clipPath>
    <clipPath id="shapeClip"><circle cx="493" cy="101" r="55"/></clipPath>
    <linearGradient id="photo" x1="0" y1="0" x2="1" y2="1">
      <stop offset="0" stop-color="#5b9cf0"/><stop offset="0.55" stop-color="#54c479"/><stop offset="1" stop-color="#f0bd4f"/>
    </linearGradient>
  </defs>

  <!-- inputs -->
  <text class="t h" x="12" y="18">Child · a square photo</text>
  <rect x="12" y="46" width="110" height="110" rx="3" fill="url(#photo)"/>
  <text class="t h" x="12" y="186">Mask · a circular graphic</text>
  <circle cx="67" cy="101" r="55" fill="none" stroke="#8b91a0" stroke-width="2" stroke-dasharray="5 4"/>
  <text class="t n" x="12" y="204">drawn round; often tinted invisible</text>

  <!-- box clip -->
  <text class="t h" x="238" y="18">Default — clipped to the BOX</text>
  <g clip-path="url(#boxClip)"><rect x="238" y="46" width="110" height="110" fill="url(#photo)"/></g>
  <rect x="238" y="46" width="110" height="110" fill="none" stroke="#e8615f" stroke-width="2"/>
  <circle cx="293" cy="101" r="55" fill="none" stroke="#8b91a0" stroke-width="1" stroke-dasharray="4 4" opacity="0.5"/>
  <text class="t bad" x="238" y="186">✗ still a square</text>
  <text class="t n" x="238" y="204">the mask is round, the clip is not</text>

  <!-- shape clip -->
  <text class="t h" x="438" y="18">alphaCutoff &gt; 0 — clipped to the SHAPE</text>
  <g clip-path="url(#shapeClip)"><rect x="438" y="46" width="110" height="110" fill="url(#photo)"/></g>
  <circle cx="493" cy="101" r="55" fill="none" stroke="#54c479" stroke-width="2"/>
  <text class="t good" x="438" y="186">✓ the avatar is round</text>
  <text class="t n" x="438" y="204">tests the sprite's alpha, not its tint</text>
</svg>