html - 关键帧功能无法正常工作

标签 html css keyframe

我正在编写教程,但停在了这个简单的关键帧。我想移动图形,但整个图像都在移动:

HTML:

<div class= "figuren"></div>
 <div id="skrollr-body">
   <div id="background" class="hello">
     <div class="page page_falling falling_hello" data-mood="hello">
       <p> heyho im nicole bla</p>
     </div>
     <div class="page page_falling falling_hobbys" data-mood="hobbys">
       <p> heyho im nicole bla</p>
     </div>
     <div class="page page_falling falling_portfolio" data-mood="portfolio">
       <p> heyho im nicole bla</p>
     </div>
     <div class="page page_falling falling_contact" data-mood="contact">
       <p> heyho im nicole bla</p>
     </div>
   </div>
 </div>

CSS:

@keyframes freak-out {
  0% { background-position: 0 0;}
  100% { background-position: 0 200%;}
}


.hello .figuren {
  animation: freak-out 1.5s steps(2) infinite;
  background: url('hello.png') 0 0 no-repeat;
  background-size: 100% auto;
}

最佳答案

试试这个:

@keyframes freak-out {
  0% { background-position: 0 0;}
  25%{ background-position: 0 30%;}
  75%{ background-position: 0 70%;}
  100% { background-position: 0 100%;}
}


.hello  {
  animation: freak-out 1.5s infinite;
  -webkit-animation: freak-out 5s infinite;
  background: url('http://www.fotos-hochladen.net/uploads/hellobo9mwya340.png') 0 0 no-repeat;
  background-size: 100% auto;
}

jsfiddle 链接:https://jsfiddle.net/uqtqzt39/6/

关于html - 关键帧功能无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34421458/

相关文章:

css - 字体加载错误 : downloadable font: kern: Too large subtable, 表格被丢弃

html - 有多张图片时,如何只在单张图片上应用CSS动画?

CSS 动画 : How to find out appropriate time intervals for a full screen background image animation?

javascript - 嵌套内容可编辑的按键事件 (jQuery)

javascript - 如何用CSS创建图片滚动视差效果?

html - 边栏菜单标题在 AdminLte 中未正确显示

css - 在向下滚动之前加载页面时标题 CSS 中的背景照片

java - JEdi​​torPane HTML 渲染

javascript - 居中的 div 锁定到位,不能上下移动

css - 如何在未悬停时暂停关键帧动画