2 442 Codepen

Рентген кашалота

SVG маска, которая позволяет создать интересный эффект "просвечивания" кашалота, как на рентгене


HTML

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <rect width="100%" height="100%" fill="#678196"/>
    <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://druart.github.io/web/images/svg/cachalote.svg" width="100%" height="100%"/>
</svg>

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <clipPath id="mask">
      <circle id="mask-circle" cx="50%" cy="50%" r="10%" style="fill:#fff"/>
    </clipPath>
  </defs>
  <g clip-path="url(#mask)">
    <rect width="100%" height="100%" fill="#272730"/>
    <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://druart.github.io/web/images/svg/cachalote_xrays.svg" width="100%" height="100%"/>
  </g>
  <circle id="circle-border" cx="50%" cy="50%" r="10%" style="stroke:#b2c3d1; fill:transparent; stroke-width:2;"/>
</svg>

CSS

body {
    height: 100vh;
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    box-shadow: 0 0 8px rgba(0,0,0,0.4);
}

svg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    width: 100vw;
    height: 100vh;
}

JS

Комментарии

  • Facebook
  • Вконтакте

Похожие статьи