所以我有這個動畫(觸發懸停)。 - >Morph Animation on CodePenCSS「剪輯路徑」變形動畫在Chrome和Firefox中不起作用,在Safari中完美運行
Safari的工作非常流暢,它在Chrome中驚人的震撼,但它在Firefox中完全不起作用。
如果有人能指出我正確的方向,我將不勝感激。這是否可以以某種方式解決?
代碼:
HTML:
<div class="shape-container">
<div class="shape"></div>
</div>
SCSS:
$globalWidth: 48px;
$globalHeight: 48px;
$zenGreen: #38CA4B;
$zenRed: #F32847;
@mixin transition($duration) {
transition: all $duration cubic-bezier(0.785, 0.135, 0.150, 0.860);;
}
@mixin shapeStroke() {
}
/* Center the demo */
html, body { height: 100%; background: #008ace;}
body {
display: flex;
justify-content: center;
align-items: center;
}
.shape-container {
width: $globalWidth;
height: $globalHeight;
@include transition(600ms);
&:hover {
@include transition(600ms);
transform: rotateZ(-180deg);
.shape {
clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
transform: scaleX(1);
&:before {
clip-path: polygon(5% 5%, 95% 5%, 95% 95%, 5% 95%);
background: $zenGreen;
}
&:after {
clip-path: polygon(25% 48%, 43% 62%, 75% 20%, 89% 31%, 75% 49%, 61% 68%, 45% 87%, 14% 61%);
transform: rotateZ(180deg) translateY(8px);
}
}
}
}
.shape {
width: $globalWidth;
height: $globalHeight;
background: white;
clip-path: polygon(50% 0, 50% 0, 100% 100%, 0 100%);
@include transition(600ms);
transform: scaleX(1.2);
position: relative;
&:before {
@include transition(600ms);
content: "";
display: block;
background: $zenRed;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
clip-path: polygon(50% 10%, 50% 10%, 92% 95%, 8% 95%);
}
&:after {
@include transition(600ms);
content: "";
display: block;
position: absolute;
width: 50%;
height: 50%;
top: 20px;
left: 12px;
z-index: 1000;
clip-path: polygon(41% 10%, 57% 10%, 57% 50%, 41% 50%, 41% 57%, 56% 57%, 57% 73%, 41% 73%);
background: white;
}
}