Last active
May 17, 2021 11:31
-
-
Save ahdezm/3561324 to your computer and use it in GitHub Desktop.
CSS Animated Repeating Gradient
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
/** | |
* CSS Animated Repeating Gradient | |
*/ | |
body { | |
background: repeating-linear-gradient(-45deg,red,red 20px,blue 20px,blue 40px); | |
background-size:56px 56px;/* This is unique for this background, need to find a pattern and develop a formula */ | |
background-position-x:0%; | |
-webkit-animation:'slide' 20s infinite linear forwards; | |
} | |
@-webkit-keyframes 'slide' { | |
0%{ | |
background-position-x:0%; | |
} | |
100% { | |
background-position-x:100%; | |
} | |
} |
Thanks works cool!
Thank you!
I'd replace the background
property with the background-image
because it can cause issues if someone will switch the order of the rules.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Firefox didn't work for two reasons:
'slide'
background-position-x
but we can usebackground-position
Here is the version that works in Safari, Chome, and Firefox: