We would like to know how to change background image position to create animation.
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#awan {<!--from w w w . j av a2s .co m-->
background-color: #C0DEED;
background: url(http://www.java2s.com/style/download.png)
center top repeat-x;
padding-top: 100px;
padding-bottom: 10px;
width: 100%;
height: 135px;
animation: awan-animasi 10s linear infinite;
-ms-animation: awan-animasi 10s linear infinite;
-moz-animation: awan-animasi 10s linear infinite;
-webkit-animation: awan-animasi 10s linear infinite;
}
@keyframes awan-animasi {
from { background-position:00;}
to {background-position: 100% 0;}
}
@-webkit-keyframes awan-animasi {
from { background-position:00;}
to {background-position: 100% 0;}
}
@-ms-keyframes awan-animasi {
from { background-position:00;}
to {background-position: 100% 0;}
}
@-moz-keyframes awan-animasi {
from { background-position:00;}
to {background-position: 100% 0;}
}
</style>
</head>
<body>
<div id="awan">java2s.com</a>
</div>
</body>
</html>
The code above is rendered as follows: