Skip to content

Instantly share code, notes, and snippets.

@macrat
Last active December 14, 2021 09:45
Show Gist options
  • Save macrat/03946eb8311d5b1adb47417918b70855 to your computer and use it in GitHub Desktop.
Save macrat/03946eb8311d5b1adb47417918b70855 to your computer and use it in GitHub Desktop.
Image XOR in SVG.
Display the source blob
Display the rendered blob
Raw
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 9" width="640" height="360">
<defs>
<clipPath id="carten-clip">
<use href="#carten" />
</clipPath>
</defs>
<rect width="16" height="9" fill="#eef" />
<text id="good" font-size="5" x="8" y="5" text-anchor="middle" font-wieght="thin">GOOD</text>
<text font-size="3" x="8" y="7" text-anchor="middle" font-weight="bold">MORNING</text>
<rect id="carten" x="-16" y="-9" width="48" height="18" fill="#104" />
<use href="#good" fill="white" clip-path="url(#carten-clip)" />
<text font-size="3.5" x="8" y="7.3" text-anchor="middle" font-weight="bold" fill="white" clip-path="url(#carten-clip)">NIGHT</text>
<style>
#carten {
animation: carten 4s linear infinite;
transform-origin: bottom center;
}
@keyframes carten {
from { transform: rotate(0); }
to { transform: rotate(360deg); }
}
</style>
</svg>
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment