- HOME
- > BLOG CATEGORY
- 【CSS】animation-directionの使い方・ 再生方向を指定する

- お知らせ
- NEW 2023.09.28 【Photoshop】ドット柄のパターンの作成について解説について
- お知らせ
- 2023.09.14 【Illustrator】ストライプ柄の作成について解説について
- お知らせ
- 2023.08.24 【Illustrator】ブラシフォントの作成について解説について
こんな方に読んでほしい
animation
プロパティについて学びたい方へ今回は、animationに関する記事になります。
animation-directionとは、アニメーションの再生方向を指定します。
前回の復習とかねて解説していきます。
[記事の内容]
animation-direction
プロパティとは、アニメーションの再生方向を指定します。
アニメーションに対して終了時点(100%)から開始時点(0%)に向かって逆方向の指定などが
可能になります。
書き方は以下のようになります
/*--@keyframes--*/
@keyframes アニメーション名 {
/*--省略--*/
}
要素 {
animation-name: アニメーション名;
animation-duration: 時間(値);
animation-direction: 値;
}
animation-direction
プロパティは、アニメーションの再生方向を指定します。
指定がない場合は開始時点(0%)から終了時点(100%)に向かって終了します。
初期値は「normal」になります。
今回は、開始の指定を0%の場合は、「width:0」、終了の指定は100%の場合は「width:100%」になっております。
共通部分である、アニメーション名「name: animation-sample」になっております。
アニメーションの1回分の時間は「duration: 3s」3秒になっております。
今回は動きが分かりやすいように、「animation-iteration-count: infinite」の指定をしています。
animation-directiontの指定
01.normal(初期値) 通常の方向に再生
02.逆方向に再生
03.偶数回で逆再生
04.奇数回で逆再生
<!--01.通常の方向に再生-->
<div class="directiont-count01 directiont">normal</div>
<!--02.逆方向に再生-->
<div class="directiont-count02 directiont">reverse</div>
<!--03.偶数回で逆再生-->
<div class="directiont-count03 directiont">alternate</div>
<!--04.奇数回で逆再生-->
<div class="directiont-count04 directiont">-reverse</div>
/*--共通 CSS--*/
.directiont {
width: 120px;
height: 30px;
line-height: 30px;
color: #333;
text-indent: 10px;
background-color: #dee1e6;
}
/*--01.通常の方向に再生--*/
.directiont-count01{
animation-name: animation-sample; /*--アニメーション名--*/
animation-duration: 3s; /*--時間--*/
animation-direction: normal; /*--再生方向--*/
}
/*--02.逆方向に再生--*/
.directiont-count01 {/*--アニメーション名・時間省略--*/
animation-direction: reverse; /*--再生方向--*/
}
/*--03.偶数回で逆再生--*/
.directiont-count01 {/*--アニメーション名・時間省略--*/
animation-direction: alternate; /*--再生方向--*/
}
/*--04.奇数回で逆再生--*/
.directiont-count01 {/*--アニメーション名・時間省略--*/
animation-direction: alternate-reverse; /*--再生方向--*/
}
@keyframes animation-sample {
0% {
width: 0;
}
100% {
width: 100%;
}
}
【STEP01 CSS】@keyframesの使い方アニメーションの動きを指定する
@keyframesとは、アニメーションの動きとタイミングを指定する際に使います。
【STEP02 CSS】animation-delayの使い方アニメーションの開始を指定する
animation-delayとは、アニメーションが開始するまでの時間を指定します。
【STEP03 CSS】animation-play-stateの使い方・再生状態を指定する
animation-play-stateとは、アニメーションが再生中か一時停止状態かを指定します。
【STEP04 CSS】animation-fill-modeの使い方・実行前後を指定する
animation-fill-modeとは、アニメーションの実行前後のスタイルを指定します。
【STEP05 CSS】animation-timing-functionの使い方・変化を指定する
animation-timing-functionとは、アニメーションの変化(速度)のスタイルを指定します。
【STEP06 CSS】animation-iteration-count・アニメーションの回数を指定する
animation-iteration-countとは、アニメーションの実行回数を指定します。
【STEP08 CSS】animationプロパティの一括指定!まとめ
今回はこれで以上です。
今回紹介したのは、アニメーションの再生方向について解説しました。
次回は「アニメーションの一括指定」について解説します。
animation-direction
プロパティは、アニメーションの再生方向を指定します。2023.06.22
2023.06.01
2022.06.10
2022.06.03
2023.09.28
2023.09.14
2023.08.24
2023.08.10
2023.07.27
2023.07.13
2023.06.15
2022.06.30
2020.03.22
2020.03.06
© 2020 shu-naka-blog