【发布时间】:2020-09-09 01:10:19
【问题描述】:
我正在尝试将动画制作成涟漪效果。它似乎在 chrome 浏览器上运行良好,但在 safari 上运行不正常,而且我在同一页面中有其他动画在 chrome 和 safari 上运行良好,但不是这个。我想知道我做错了什么。
我尝试调试它,我可以看到 Safari 图形选项卡中有一条消息说
“这个动画没有关键帧”
我的css代码:
.ripple-animation {
&::after {
@include rings(2s, 40s);
}
&::before {
@include rings(2s, 40s);
}
}
@mixin rings($duration, $delay) {
opacity: 0.5;
// display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
position: absolute;
top: -8px;
left: -10px;
right: 0;
bottom: 0;
content: '';
height: 120%;
width: 110%;
border: 4px solid rgba(0, 0, 0, 0.4);
border-radius: 100%;
-webkit-animation-name: ripple;
-webkit-animation-duration: $duration;
-webkit-animation-delay: $delay;
-webkit-animation-iteration-count: infinite;
-webkit-animation-timing-function: cubic-bezier(.65, 0, .34, 1);
animation-name: ripple;
animation-duration: $duration;
animation-delay: $delay;
animation-iteration-count: infinite;
animation-timing-function: cubic-bezier(.65, 0, .34, 1);
}
@-webkit-keyframes ripple {
from {
opacity: 1;
-webkit-transform: scale3d(0.8, 0.8, 0.5);
transform: scale3d(0.8, 0.8, 0.5);
}
to {
opacity: 0;
-webkit-transform: scale3d(1.1, 1.1, 1);
transform: scale3d(1.1, 1.1, 1);
}
}
@keyframes ripple {
from {
opacity: 1;
-webkit-transform: scale3d(0.8, 0.8, 0.5);
transform: scale3d(0.8, 0.8, 0.5);
}
to {
opacity: 0;
-webkit-transform: scale3d(1.1, 1.1, 1);
transform: scale3d(1.1, 1.1, 1);
}
}
【问题讨论】:
-
请包含完整代码,使其至少可运行
-
不要在@keyframes 中使用-webkit-transform,只能在@-webkit-keyframes 中使用
-
你的 safari 版本是什么?
标签: html css safari css-animations keyframe