ぽよんぽよんッシャッ!!!をやりたくて作ってみました。
cssのみで実現してます。
See the Pen 読み込んだらスライドして表示されるcssアニメーション by takapen (@takapen) on CodePen.
html
test
ccss
css
.main {
width: 300px;
text-align: center;
border: 3px solid #333;
overflow: hidden;
position: relative;
}
.main:before {
position: absolute;
top: 0;
left: 0;
z-index: 1;
content: '';
width: 120%;
height: 100%;
background: #333;
animation: slide 2000ms ease-in-out forwards;
}
@keyframes slide {
0% {
transform-origin: right top;
transform: skewX(-30deg) scale(1, 1);
}
80% {
transform-origin: right top;
transform: skewX(-30deg) scale(1, 1);
}
100% {
transform-origin: right top;
transform: skewX(-30deg) scale(0, 1);
}
}
.loading {
width: 10px;
height: 10px;
border-radius: 50%;
background: #fff;
display: block;
position: absolute;
bottom: 30%;
left: calc(50% - 5px);
z-index: 2;
animation: bouncing 0.4s alternate infinite cubic-bezier(.6,.05,.15,.95),
fadeout 2000ms ease-in-out forwards;
}
@keyframes bouncing {
0% {
transform: translate3d(0, 10px, 0) scale(1.2, 0.85);
}
100% {
transform: translate3d(0, -20px, 0) scale(0.9, 1.1);
}
}
@keyframes fadeout {
0% {
display: block;
opacity: 1;
}
1% {
display: block;
opacity: 1;
}
90% {
display:block;
opacity: 1;
}
91% {
display:none;
opacity: 0;
}
100% {
display:none;
opacity: 0;
}
}