I'm breaking my head with something simple, I usually solve these problems by looking at google, but today I was not that lucky.
And the following, I want to create a background with the class "animation linear infinite", but I want to put a PNG image over with the same effect, moving the image along with the background color.
I was not able to overwrite the image in any way over the background color.
Note: I already tried z-index but I did not succeed.
.imagem {
width: 500px;
height: 500px;
background: url("https://i.imgur.com/XhYIPUs.png") repeat left top;
-webkit-animation: 40s linear infinite LoadingBarProgress, .5s ease-out LoadingBarEnter;
animation: 40s linear infinite LoadingBarProgress, .5s ease-out LoadingBarEnter;
-webkit-transform-origin: left;
transform-origin: left;
}
.cor-de-fundo {
width: 500px;
height: 500px;
background: #a8a8a8 linear-gradient(to right, #a8a8a8, #3d3d3d, #ffafa9, #3d3d3d, #a8a8a8);
background-size: 500%;
-webkit-animation: 40s linear infinite LoadingBarProgress, .5s ease-out LoadingBarEnter;
animation: 40s linear infinite LoadingBarProgress, .5s ease-out LoadingBarEnter;
-webkit-transform-origin: left;
transform-origin: left;
}
@-webkit-keyframes LoadingBarProgress {
0% {
background-position: 0% 0
}
to {
background-position: 125% 0
}
}
@keyframes LoadingBarProgress {
0% {
background-position: 0% 0
}
to {
background-position: 125% 0
}
}
@-webkit-keyframes LoadingBarEnter {
0% {
-webkit-transform: scaleX(0);
transform: scaleX(0)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
@keyframes LoadingBarEnter {
0% {
-webkit-transform: scaleX(0);
transform: scaleX(0)
}
to {
-webkit-transform: scaleX(1);
transform: scaleX(1)
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="imagem cor-de-fundo"></div>
</body>
</html>