创建一个HTML5动画,用于将船从英国移动到霍巴特,如下面的屏幕截图所示:

时间:2013-12-05 12:47:11

标签: html5 html5-animation

  

创建一个HTML5动画,用于将船从英国移至霍巴特,如下面的屏幕截图所示:

image1

1 个答案:

答案 0 :(得分:3)

解决方案:http://codepen.io/rafaelcastrocouto/pen/lpBGz

#wrap { position: relative; }
#boat {
  background-image: url(http://i.stack.imgur.com/kKL72.jpg);
  background-position: -205px -203px;
  width: 25px; height: 25px;
  border-radius: 50%;
  position: absolute;
  border: 1px solid white;
  top: 55px; left: 60px;
  animation: travel 5s linear infinite;
}
@keyframes travel {
  0% {top: 55px; left: 60px;}
  15% {top: 80px; left: 20px;}
  30% {top: 110px; left: 5px;}
  50% {top: 150px; left: 35px;}
  70% {top: 200px; left: 70px;}
  100% {top: 200px; left: 200px;}
}

详细了解:https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Using_CSS_animations