Skip to content

Instantly share code, notes, and snippets.

@austinheap
Created October 10, 2026 01:00
Show Gist options
  • Select an option

  • Save austinheap/6c1fd3dca14ea71df44518aaff02bc06 to your computer and use it in GitHub Desktop.

Select an option

Save austinheap/6c1fd3dca14ea71df44518aaff02bc06 to your computer and use it in GitHub Desktop.
5. Text masking
<div class="masking-container">
<h1 class="masked-text">Masked Animation</h1>
</div>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background: #222;
font-family: 'Arial', sans-serif;
overflow: hidden;
}
.masked-text {
font-size: 8rem;
font-weight: bold;
color: transparent;
background-image: url('https://images.unsplash.com/photo-1732535725600-f805d8b33c9c?q=80&w=1470&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D');
background-size: 200%; /* Enlarged for smooth animation */
background-position: 0 50%;
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
animation: animate-background 5s infinite alternate linear;
}
@keyframes animate-background {
0% {
background-position: 0 50%;
}
100% {
background-position: 100% 50%;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment