Created
July 14, 2024 20:13
-
-
Save colinfwren/e620ab3b45d0003471e9231cedfeda72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.bag { | |
/* hoist the item list scroll progress scope to the parent so can be shared */ | |
timeline-scope: --item-list-scroll-timeline; | |
} | |
.item-list { | |
/* make the item lists y-axis scroll progress available as a variable */ | |
scroll-timeline: --item-list-scroll-timeline y; | |
} | |
.bag-section-image { | |
/* The animation(s) to drive using the scroll progress */ | |
animation: item-bag-image linear; | |
/* Hook up the item lists scroll progress to drive the animation */ | |
animation-timeline: --item-list-scroll-timeline; | |
} | |
@keyframes item-bag-image { | |
/* control the changing of the image based on scroll progress */ | |
0% { | |
background-image: url('img/items.png'); | |
} | |
46% { | |
background-image: url('img/pokeballs.png'); | |
} | |
53% { | |
background-image: url('img/key-items.png'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment