You can move the element along the sine path using 2 CSS keyframe animations . The point is to translate the left right using the linear synchronization function and up / down with the idle time synchronization function.
To do this, you need to translate the container and move the element up and down using two different key frame animations . Here is an example:
div{ position:absolute; left:0; width:10%; animation: translate 15s infinite linear; } img { position:absolute; animation: upDown 1.5s alternate infinite ease-in-out; width:100%; } @keyframes upDown { to { transform: translatey(100px);} } @keyframes translate { to { transform: translatex(900%);} }
<div> <img src="http://i.imgur.com/QdWJXta.png"> </div>
Note that this example does not contain vendor prefixes. For more information, see CanIuse for:
source share