【问题标题】:Transform: perspective(#) on iOS 8 Mobile Safari glitches and hides element变换:iOS 8 Mobile Safari 上的透视(#)故障并隐藏元素
【发布时间】:2014-12-12 00:46:58
【问题描述】:

在项目中使用 animate.css 并在 iOS8 Mobile Safari 上遇到了主要障碍。

使用透视的动画都不起作用。这已被识别为known issue,但尚未提供解决方案。

我在下面包含了特定的 CSS 代码供您参考。

非常感谢任何帮助,因为我在任何地方都没有发现任何关于这个问题的信息。

@-webkit-keyframes flipInX {
  0% {
    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
    transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
    -webkit-transition-timing-function: ease-in;
    transition-timing-function: ease-in;
    opacity: 0;
  }

  40% {
    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
    transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
    -webkit-transition-timing-function: ease-in;
    transition-timing-function: ease-in;
  }

  60% {
    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
    transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
    opacity: 1;
  }

  80% {
    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
    transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
  }

  100% {
    -webkit-transform: perspective(400px);
    transform: perspective(400px);
  }
}

@keyframes flipInX {
  0% {
    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
    -ms-transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
    transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
    -webkit-transition-timing-function: ease-in;
    transition-timing-function: ease-in;
    opacity: 0;
  }

  40% {
    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
    -ms-transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
    transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
    -webkit-transition-timing-function: ease-in;
    transition-timing-function: ease-in;
  }

  60% {
    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
    -ms-transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
    transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
    opacity: 1;
  }

  80% {
    -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
    -ms-transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
    transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
  }

  100% {
    -webkit-transform: perspective(400px);
    -ms-transform: perspective(400px);
    transform: perspective(400px);
  }
}

.flipInX {
  -webkit-backface-visibility: visible !important;
  -ms-backface-visibility: visible !important;
  backface-visibility: visible !important;
  -webkit-animation-name: flipInX;
  animation-name: flipInX;
}

【问题讨论】:

    标签: css mobile-safari transform webkit-perspective


    【解决方案1】:

    由于它在动画中没有变化,请尝试使用属性而不是变换。

    -webkit-perspective: 400px;
    perspective: 400px;
    

    所以从关键帧中删除并放入样式规则:

      0% {
        -webkit-transform: rotate3d(1, 0, 0, 90deg);
        transform: rotate3d(1, 0, 0, 90deg);
        -webkit-transition-timing-function: ease-in;
        transition-timing-function: ease-in;
        opacity: 0;
      }
    
    .flipInX {
      -webkit-backface-visibility: visible !important;
      -ms-backface-visibility: visible !important;
      backface-visibility: visible !important;
      -webkit-animation-name: flipInX;
      animation-name: flipInX;
      -webkit-perspective: 400px;
      perspective: 400px;
    }
    

    编辑:

    无法测试,但我可以继续往墙上扔意大利面。尝试将 rotate3d 更改为等效:

      0% {
        -webkit-transform: rotateY(90deg);
        transform: rotateY(90deg);
        -webkit-transition-timing-function: ease-in;
        transition-timing-function: ease-in;
        opacity: 0;
      }
    

    【讨论】:

    • 不幸的是似乎没有帮助 - 它破坏了动画。在 this pen 上评论和取消评论 CSS 以比较差异。
    • 呃!!哈哈。无论如何,它们明显不同。只是一个想法。您是否尝试过完全删除它?
    • 不幸的是没有修复它。怀念 Apple 没有每 5 分钟发布一次有缺陷的软件的日子!
    • 感谢@todd 的建议
    猜你喜欢
    • 2014-11-10
    • 2022-06-24
    • 2020-11-18
    • 1970-01-01
    • 2017-08-21
    • 2023-03-14
    • 1970-01-01
    • 2022-06-14
    • 1970-01-01
    相关资源
    最近更新 更多