减慢背景动画CSS?

问题描述 投票:-1回答:1

如何减慢此动画的速度并使所有浏览器更流畅?有什么办法吗?

@keyframes animatedBackground {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 100% 0;
  }
}
#animate-area {
  width: 200px;
  height: 200px;
  background-image: url(https://github.githubassets.com/images/modules/open_graph/github-mark.png);
  background-position: 0px 0px;
  background-repeat: repeat-x;
  animation: animatedBackground 10s linear infinite alternate;
}
<div id="animate-area"></div>
html css html5
1个回答
0
投票

只需给animation更长的时间。

以下内容从10s更改为30s

@keyframes animatedBackground {
  from {
    background-position: 0 0;
  }
  to {
    background-position: 100% 0;
  }
}
#animate-area {
  width: 200px;
  height: 200px;
  background-image: url(https://github.githubassets.com/images/modules/open_graph/github-mark.png);
  background-position: 0px 0px;
  background-repeat: repeat-x;
  animation: animatedBackground 30s linear infinite alternate;
}
<div id="animate-area"></div>
© www.soinside.com 2019 - 2024. All rights reserved.