CSS3のキーフレームでつくるアニメーション


@keyframesって何?
@keyframesとは
対応ブラウザ
プロパティ一覧
実演
文字だけでは分かりにくいですよね。
それでは実際に実演していくと同時に、どうやってアニメーションを発生させるかを
みていきましょう。
.move_testはいままで説明したものをショートハンドでまとめたものです。
@keyframesの部分で動かしたい要素に0%(スタート)から100%(アニメーション終了)までの間で
CSSを指定してあげます。
.move_test{
animation: test 4s ease-in-out 2s infinite normal both;
-webkit-aanimation: test 4s ease-in-out 2s infinite normal both;
}
@keyframes test {
0% {transform: translateX(-150%); opacity: 0;}
30%{transform: translateX(4%); opacity: 1;}
70%{transform: translateX(4%); color: red; opacity: 1;}
100% {transform: translateX(500%); opacity: 0;}
}
@-webkit-keyframes test {
0% {-webkit-transform: translateX(-150%); opacity: 0;}
30%{-webkit-transform: translateX(4%); opacity: 1;}
70%{-webkit-transform: translateX(4%); color: red; opacity: 1;}
100% {-webkit-transform: translateX(500%); opacity: 0;}
}
まとめ
いかがでしたか?
今までJavaScriptやFlashでつくらなればいけなかったアニメーションをCSSで簡単に表現し、工夫次第で、CSSだけでもユーザーの目をひく質の高いインタラクションを実現することができます。
IE10以降やGoogle Chrome、Firefox最新版などのモダンブラウザと呼ばれるものであれば、遠慮なくつかえるので、ぜひ試してみてください。
RECENT POSTS
Vol.203
What Is Design Management
Vol.202
Why Hiring No Longer Works— Redesigning Organizations and Decisions for an Uncertain Age
Vol.201
How to Choose a Branding Agency: 5 Criteria to Avoid Failure
Vol.200
Design Management: A Practical Guide for SMEs and Startups to Drive Real Results
Vol.199
How to Rebuild Brand Competitiveness: A Practical Guide to Brand Management for SMEs
Vol.198
From parent–child bonds to community: The future of education that nurtures diversity and designs relationships
TRENDING
Vol.164
Steps and strategies for internal branding to enhance employee engagement

Vol.160
What Small and Medium-sized Enterprises Should Do About Employer Branding

Vol.159
User behavior by design | The psychology of UX and behavioral change







