【问题标题】:border animation linear gradient vertical movement边框动画线性渐变垂直移动
【发布时间】:2018-09-11 12:59:47
【问题描述】:

我无法让此边框动画在其他浏览器 (IE) 上运行。 http://babarogic.disclosed.site 检查实时预览或 sn-p down。 在这个问题上做了很多搜索,但没有一个对我有用。也许我在某个地方犯了错误。

谢谢

body {
background-color: black;
}
.border-main {
    position: fixed;
    right: 0%;
    left: 0%;
    top: 0%;
    bottom: 0%;
    width: 75%;
  /* 90% of viewport vidth */
  height: 60%;
  /* ratio = 9/16 * 90 = 50.625 */
  max-height: 70vh;
  max-width: 140vh;
  /* 16/9 * 90 = 160 */
  margin: auto;
    overflow: hidden;
    border: 1px solid #000;
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
    z-index: 9;
    pointer-events: none;
    -webkit-animation: clipMe 8s linear infinite;
            animation: clipMe 8s linear infinite;
    -webkit-border-image: 
      -webkit-gradient(linear, 0 100%, 0 0, from(white), to(rgba(0, 0, 0, 0))) 1 100%;
    -webkit-border-image: 
      -webkit-linear-gradient(bottom, white, rgba(0, 0, 0, 0)) 1 100%;  
    -o-border-image:
      -o-linear-gradient(bottom, white, rgba(0, 0, 0, 0)) 1 100%;
    border-image:
      -webkit-gradient(linear, left bottom, left top, from(white), to(rgba(0, 0, 0, 0))) 1 100%;
    border-image:
      linear-gradient(to top, white, rgba(0, 0, 0, 0)) 1 100%;
    
}

@-webkit-keyframes clipMe {
  0%    { height: 0%; }
  100%  { height: 60%; }
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

@keyframes clipMe {
  0%    { height: 0%; }
  100%  { height: 60%; }
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}
<div class="border-main"></div>

【问题讨论】:

  • 你想让这样的东西在 IE 上运行吗? ...祝你好运...

标签: html css animation keyframe


【解决方案1】:

如果您在动画帧中放置一些顺序,它可以在 IE11 上运行:

@keyframes clipMe {
  0%    { height: 0%; opacity: 0; }
  50%   { opacity: 1; }
  100%  { height: 60%; opacity: 0; }
}

检查结果here

According to MDN,IE11 正在做正确的事:丢弃重复的关键帧,只取最新的。

如果一个关键帧被定义了多次但不是全部都受到影响 属性在每个关键帧中,只有在 考虑最新的关键帧。

【讨论】:

  • 非常感谢,它成功了,我之前确实尝试过重新排序,但显然我在某个地方做错了。
猜你喜欢
  • 2022-12-14
  • 1970-01-01
  • 2019-07-30
  • 2010-12-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-09-30
  • 2014-06-19
相关资源
最近更新 更多