#0202002
タップでプレビュー
<button class="c-shuffleLink">
<span data-text="H">H</span>
<span data-text="o">o</span>
<span data-text="v">v</span>
<span data-text="e">e</span>
<span data-text="r">r</span>
</button>
.c-shuffleLink {
width: -moz-fit-content;
width: fit-content;
padding: 4px 16px;
border: #fff 1px solid;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.c-shuffleLink:hover span {
animation: slide-up 1s ease;
}
.c-shuffleLink span {
padding: 0;
color: #fff;
display: block;
position: relative;
}
.c-shuffleLink span:nth-child(1) {
animation-delay: 0s;
}
.c-shuffleLink span:nth-child(2) {
animation-delay: 0.15s;
}
.c-shuffleLink span:nth-child(3) {
animation-delay: 0.3s;
}
.c-shuffleLink span:nth-child(4) {
animation-delay: 0.45s;
}
.c-shuffleLink span:nth-child(5) {
animation-delay: 0.6s;
}
.c-shuffleLink span:nth-child(6) {
animation-delay: 0.75s;
}
.c-shuffleLink span:nth-child(7) {
animation-delay: 0.9s;
}
.c-shuffleLink span:nth-child(8) {
animation-delay: 1.05s;
}
.c-shuffleLink span:nth-child(9) {
animation-delay: 1.2s;
}
/* 10文字まで対応 */
.c-shuffleLink span:nth-child(10) {
animation-delay: 1.35s;
}
@keyframes slide-up {
0% {
transform: translateY(0);
opacity: 1;
filter: blur(0px);
}
50% {
opacity: 0.5;
filter: blur(0.5px);
}
90% {
opacity: 1;
filter: blur(0px);
}
100% {
transform: translateY(-200%);
}
}
.c-shuffleLink span::after {
content: attr(data-text);
display: block;
position: absolute;
top: 200%;
left: 0;
width: 100%;
height: 100%;
}
.c {
&-shuffleLink {
width: fit-content;
padding: 4px 16px;
border: #fff 1px solid;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
&:hover {
span {
animation: slide-up 1s ease;
}
}
span {
padding: 0;
color: #fff;
display: block;
line-height: 75%;
position: relative;
// 10文字まで対応
@for $i from 1 through 10 {
&:nth-child(#{$i}) {
animation-delay: 0.15s * ($i - 1);
}
}
@keyframes slide-up {
0% {
transform: translateY(0);
opacity: 1;
filter: blur(0px);
}
50% {
opacity: 0.5;
filter: blur(0.5px);
}
90% {
opacity: 1;
filter: blur(0px);
}
100% {
transform: translateY(-200%);
}
}
&::after {
content: attr(data-text);
display: block;
position: absolute;
top: 200%;
left: 0;
width: 100%;
height: 100%;
}
}
}
}