Ich arbeite an einem Button Hover-Effekt. Ich habe es geschafft, es bei Hover zu animieren, aber ich kämpfe um die Animation umzukehren.CSS & SVG Animation
Ich habe versucht, die Strich-Array und Offset zu ändern, aber keiner scheint effektiv zu arbeiten.
Hier ist mein Markup:
.btn {
\t background: #e02c26;
\t font-weight: 100;
\t color: #fff;
\t cursor: pointer;
\t display: inline-block;
\t font-size: 16px;
\t font-weight: 400;
\t line-height: 45px;
\t margin: 0 auto 2em;
\t max-width: 160px;
\t position: relative;
\t text-decoration: none;
\t text-transform: uppercase;
\t vertical-align: middle;
\t width: 100%;
}
.btn span {
\t position: absolute;
\t width: 100%;
\t text-align: center;
}
.btn svg {
\t height: 45px;
\t left: 0;
\t position: absolute;
\t top: 0;
\t width: 100%;
}
.btn rect {
\t fill: none;
\t stroke: #565656;
\t stroke-width: 2;
\t stroke-dasharray: 422, 0;
}
.btn:hover {
\t background: rgba(225, 51, 45, 0);
\t font-weight: 900;
\t letter-spacing: 1px;
}
.btn:hover rect {
\t stroke-width: 5;
\t stroke-dasharray: 15, 310;
\t stroke-dashoffset: 48;
\t -webkit-transition: all 1.35s cubic-bezier(0.19, 1, 0.22, 1);
\t transition: all 1.35s cubic-bezier(0.19, 1, 0.22, 1);
}
<a href="#" class="btn">
<svg>
\t <rect x="0" y="0" fill="none" width="100%" height="100%"/>
</svg>
<span>Hover</span>
</a>
ausgezeichnet, vielen Dank! – CharlyAnderson
Gern geschehen :) – Chiller