ページを開くときに、ページが読み込まれる状況がよく発生します。フロントエンド開発者は、CSS3 を使用してページ読み込みアニメーション効果を実現する方法を知っていますか?この記事では、クールで実用的な CSS3 読み込みアニメーション効果コードを紹介します。これは一定の参考価値があるので、興味のある友人は参照してください。
ページ読み込み読み込みアニメーションを作成するには、アニメーション アニメーション、表示、変換属性など、CSS3 の多くの属性を使用する必要があります。よくわからない場合は、以前の記事を参照してください。を紹介するか、CSS3 ビデオ チュートリアル にアクセスしてください。
デモの例: 列状のアニメーション読み込みエフェクトを作成します。具体的なコードは次のとおりです。
HTML 部分:
1 2 3 4 5 6 7 | <div class = "box" >
<div class = "r1" ></div>
<div class = "r2" ></div>
<div class = "r3" ></div>
<div class = "r4" ></div>
<div class = "r5" ></div>
</div>
|
ログイン後にコピー
。 CSS 部分:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | .box {
margin: 100px auto;
width: 50px;
height: 60px;
}
.box>div {
background-color: #67CF22;
height: 100%;
width: 6px;
display: inline-block;
-webkit-animation: stretchdelay 1.2s infinite ease-in-out;
animation: stretchdelay 1.2s infinite ease-in-out;
}
.box .r2 {
-webkit-animation-delay: -1.1s;
animation-delay: -1.1s;
}
.box .r3 {
-webkit-animation-delay: -1.0s;
animation-delay: -1.0s;
}
.box .r4 {
-webkit-animation-delay: -0.9s;
animation-delay: -0.9s;
}
.box .r5 {
-webkit-animation-delay: -0.8s;
animation-delay: -0.8s;
}
@-webkit-keyframes stretchdelay {
0%,
40%,
100% {
-webkit-transform: scaleY(0.4)
}
20% {
-webkit-transform: scaleY(1.0)
}
}
@keyframes stretchdelay {
0%,
40%,
100% {
transform: scaleY(0.4);
-webkit-transform: scaleY(0.4);
}
20% {
transform: scaleY(1.0);
-webkit-transform: scaleY(1.0);
}
}
|
ログイン後にコピー
効果は図に示すとおりです:

上記のコードは、ページ読み込みアニメーション効果を実現するために CSS3 を共有しました。プロジェクトで頻繁に使用されており、直接使用できます。この記事が役立つことを願っています。関連チュートリアルの詳細については、CSS3 オンライン マニュアル
をご覧ください。
以上がPure CSS3でページ読み込みアニメーション効果を実現(コード付き)の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。