Skip to content

Instantly share code, notes, and snippets.

@kobitoDevelopment
Last active March 24, 2025 09:34
Show Gist options
  • Save kobitoDevelopment/b07425e788c3998d49cf5cbf5a46670c to your computer and use it in GitHub Desktop.
Save kobitoDevelopment/b07425e788c3998d49cf5cbf5a46670c to your computer and use it in GitHub Desktop.
body {
padding-top: 100vh;
padding-bottom: 100vh;
}
.container {
position: relative;
width: 100%;
height: 50vh;
background-color: orange;
view-timeline-name: --container;
view-timeline-axis: block;
& .scrub {
position: absolute;
top: 0%;
right: 0;
width: 100%;
height: 100%;
object-fit: cover;
background-color: blue;
animation: scrub linear forwards;
animation-timeline: view(block);
}
}
@keyframes scrub {
0% {
object-position: 0% 0%;
}
100% {
object-position: 0% 100%;
}
}
<div class="container">
<img src="assets/images/1.jpg" class="scrub" alt="" />
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment