CSS3 旋转动画不适用于 Firefox

标签 css firefox animation rotation

我试图让它适用于所有浏览器,但我无法在 Firefox 中重现效果:

http://jsfiddle.net/vq3xuafb/

我尝试复制这样的代码,其中包含 -webkit- 并更改为 -moz-,但无法正常工作。

#ball_3 {
    -webkit-animation-timing-function: cubic-bezier(0.5, 0.7, 0.9, 0.9);
    -webkit-animation-name: rotate; 
    -webkit-animation-duration: 2s; 
    -webkit-animation-iteration-count: infinite;
    -webkit-transform-origin: 6px 30px;
}
@-webkit-keyframes rotate {
    0% {-webkit-transform: rotate(0deg) scale(1);}
    100% {-webkit-transform: rotate(1440deg) scale(1);}
}

我也不知道它是否适用于 Opera 或 IE。

最佳答案

这是因为您缺少 @keyframesanimationtransform 的标准前缀。

此外,您还可以使用此速记来缩小animation 语法。

animation: rotate 2s infinite cubic-bezier(0.5, 0.3, 0.9, 0.9);

Updated Fiddle

#hidder {
  display: block;
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: grey;
  z-index: 99988;
  opacity: 0.5;
}
#spinner.active {
  display: block;
}
#spinner {
  display: block;
  position: fixed;
  height: 60px;
  width: 60px;
  top: 40%;
  left: 48%;
  z-index: 99989;
}
.spinner_ball {
  position: absolute;
  display: block;
  background-color: white;
  left: 24px;
  width: 12px;
  height: 12px;
  border-radius: 6px;
}
#ball_1,
#ball_2,
#ball_3 {
  -webkit-animation: rotate 2s infinite cubic-bezier(0.5, 0.3, 0.9, 0.9);
  animation: rotate 2s infinite cubic-bezier(0.5, 0.3, 0.9, 0.9);
  -webkit-transform-origin: 6px 30px;
  transform-origin: 6px 30px;
}
#ball_2 {
  -webkit-animation: rotate 2s infinite cubic-bezier(0.5, 0.5, 0.9, 0.9);
  animation: rotate 2s infinite cubic-bezier(0.5, 0.5, 0.9, 0.9);
}
#ball_3 {
  -webkit-animation: rotate 2s infinite cubic-bezier(0.5, 0.7, 0.9, 0.9);
  animation: rotate 2s infinite cubic-bezier(0.5, 0.7, 0.9, 0.9);
}
@-webkit-keyframes rotate {
  0% {
    -webkit-transform: rotate(0deg) scale(1);
  }
  100% {
    -webkit-transform: rotate(1440deg) scale(1);
  }
}
@keyframes rotate {
  0% {
    transform: rotate(0deg) scale(1);
  }
  100% {
    transform: rotate(1440deg) scale(1);
  }
}
<div id='hidder'></div>
<div id="spinner"> <span id="ball_1" class="spinner_ball"></span>
  <span id="ball_2" class="spinner_ball"></span>
  <span id="ball_3" class="spinner_ball"></span>
</div>

关于CSS3 旋转动画不适用于 Firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27821405/

相关文章:

java - Android动画顺时针

css - 如何在显示表格单元格 div 内滚动 100% 宽度、100% 高度的大表格而不是整个页面

html - 部分中的全宽 Youtube 视频背景

html - 为什么我的 box-shadow 不能在这些 flex children 上正确重叠?

javascript - 滚动溢出的元素时禁用窗口滚动

html - CSS 响应式,等边三 Angular 形,适用于 Firefox

javascript - 内联 JavaScript 在 Chrome 中有效,但在 Firefox 中无效

javascript - 纯数字 JavaScript Firefox 解决方案

jQuery - 带有CSS动画的淡入淡出错误

r - R Markdown 中的动画