WEBページ作成リファレンス
cman.jp cman.jp > WEBページ作成TOP > CSSリファレンス > 「アニメーションの設定」

animation 「アニメーション」

「animation」は要素をアニメーション(指定した動き)に変化させる事が出来ます。
ちょっと面白いページの作成に便利な機能となします。

CSS Ver.適用要素継承
3.0全要素なし
広告

animationの指定方法

プロパティ/設定値意味
animation : [ルール名]
[変化時間]
[変化速度]
[変化開始時間]
[繰返し回数]
[終了後の動き]
まとめて指定(ショートハンド)の場合は
以下のプロパティー値をスペース区切りで指定する
animation-name : [ルール名] アニメーションの動きを指定する「@keyframes」ルール名を指定する。
指定しない場合は「none」となる
@keyframes」参照
animation-duration : [変化時間] 1回のアニメーション再生時間を秒単位で設定
指定しない場合は「0s」となる
animation-timing-function : [変化速度]
ease開始と終了が滑らか
linear一定速度
ease-in開始ゆっくり
ease-out終了ゆっくり
ease-in-out開始終了ゆっくり
step-startすぐに最終状態にする
step-end最後に終了状態にする
steps(n, end)n段階で変化する
指定しない場合は「ease」となる
animation-delay : [変化開始時間] アニメーション開始までの時間を秒で指定。
指定しない場合は「0s」となる
animation-iteration-count : [繰返し回数] アニメーションを繰り返す回数を設定
n繰り返す回数
infinite無限に繰り返す
指定しない場合は「1」となる
animation-direction : [終了後の動き] 1回のアニメーション終了後の動きを設定
normal順方向
alternate逆方向
指定しない場合は「normal」となる
デフォルト:「タグ毎のスタイル初期値」を参照
ページTOP

animation のサンプル


<style type="text/css">
.s1{
  animation-name           : sampleAnime;  /* ルール名 */
  animation-duration       : 5s;            /* 実行時間 */
  animation-timing-function: ease;          /* 動き速度 */
  animation-delay          : 1s;            /* 開始遅延時間 */
  animation-iteration-count: infinite;     /* 再生回数 */
  animation-direction      : alternate;    /* 終了後の動き */
  /* まとめて指定(ショートハンド)の場合は
  animation : sampleAnime 5s ease 1s infinite alternate; */

  width  : 50px;
  height : 50px;
  color  : blue;
  border :1px solid blue;
  background-color : lightcyan;
  transform : rotateX(0deg) rotateY(0deg) rotateZ(0deg);
}
@keyframes sampleAnime {
  100% {width  : 200px;
        height : 100px;
        color  :#fff;
        border :3px solid red;
        background-color : blue;
        transform : rotateX(360deg) rotateY(360deg) rotateZ(360deg);
       }
}
</style>

<!-- html -->
<div class="s1">ABC</div>
ABC
ページTOP

animation の自由に指定できるサンプル

<style type="text/css">
.s9{
  width            : 200px;
  height           : 100px;
  background-color : blue;
  color            : #fff;
  animation        : sample1Anime 下記参照
}
@keyframes sample1Anime{
  下記参照
}
</style>

<!-- html -->
<div class="s9" id="moveSample1">動的サンプル</div>
animationプロパティ設定値
アニメーション
@keyframes」参照
animation-duration

【変化の時間】

0s
animation-timing-function

【変化速度】

animation-delay

【変化開始時間】

0s
animation-iteration-count

【繰り返し回数】

無限
animation-direction

【終了後の動き】

↓上記条件でアニメーションが変化します。

動的サンプル
ページTOP
広告
QrCode
このページのURL
スマートフォン・タブレット運営 : CMAN 株式会社シーマン