アニメーションをどのように実行するか進捗方法を加速曲線で指定します。
animation-timing-function:
Sample
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Language" content="ja" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="imagetoolbar" content="no" /> <title>animation-timing-function</title> <link rel="stylesheet" type="text/css" href="/content/lib/global.css" /> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> <script type="text/javascript" src="./js/jquery.vendorprefix.js"></script> <script type="text/javascript"> $(function(){ $("#rgrp input[type=radio]").click(function(){ var val=this.value; var prefix=$.fn.VendorPrefix(); var rint = Math.round(0xffffff * Math.random()); var rgb='rgb(' + (rint >> 16) + ',' + (rint >> 8 & 255) + ',' + (rint & 255) + ')'; $("#sample").find("p").remove(); var $obj=$("<p>Sample</p>").appendTo("#sample"); $obj.css("background-color",rgb); $obj.css(prefix+"animation-timing-function",val); $obj.css("animation-timing-function",val); }); }); </script> <style type="text/css"> #sample { width:500px; height:300px; background:#eee; } #samples div, #sample p { margin:0; padding:0; width:100px; height:100px; background:#ccc; position:relative; animation:myani 3s ease 1s 1 alternate; /* CSS3 */ -webkit-animation:myani 3s ease 1s 1 alternate; /* Chrome, Safari */ -moz-animation:myani 3s ease 1s 1 alternate; /* Firefox */ -ms-animation:myani 3s ease 1s 1 alternate; /* IE */ -o-animation:myani 3s ease 1s 1 alternate; /* Opera */ animation-fill-mode:forwards; /* アニメーションを最後のフレームで停止 */ -webkit-animation-fill-mode:forwards; -moz-animation-fill-mode:forwards; -ms-animation-fill-mode:forwards; -o-animation-fill-mode:forwards; } @keyframes myani { from {left:0px;} to {left:400px;} } @-webkit-keyframes myani { from {left:0px;} to {left:400px;} } @-moz-keyframes myani { from {left:0px;} to {left:400px;} } @-ms-keyframes myani { from {left:0px;} to {left:400px;} } @-o-keyframes myani { from {left:0px;} to {left:400px;} } #samples { width:500px; background:#000; } #samples div { margin:10px 0; padding:0; height:2em; line-height:2em; } /* samples */ #samples #linear { animation-timing-function:linear; -webkit-animation-timing-function:linear; -moz-animation-timing-function:linear; -ms-animation-timing-function:linear; -o-animation-timing-function:linear; } #samples #ease { animation-timing-function:ease; -webkit-animation-timing-function:ease; -moz-animation-timing-function:ease; -ms-animation-timing-function:ease; -o-animation-timing-function:ease; } #samples #ease-in { animation-timing-function:ease-in; -webkit-animation-timing-function:ease-in; -moz-animation-timing-function:ease-in; -ms-animation-timing-function:ease-in; -o-animation-timing-function:ease-in; } #samples #ease-out { animation-timing-function:ease-out; -webkit-animation-timing-function:ease-out; -moz-animation-timing-function:ease-out; -ms-animation-timing-function:ease-out; -o-animation-timing-function:ease-out; } #samples #ease-in-out { animation-timing-function:ease-in-out; -webkit-animation-timing-function:ease-in-out; -moz-animation-timing-function:ease-in-out; -ms-animation-timing-function:ease-in-out; -o-animation-timing-function:ease-in-out; } </style> <link rel="stylesheet" type="text/css" href="/common/css/example.css"></head> <body id='example3' class='example'><div class="ads" style="margin:32px auto;text-align:center;"></div><h1 class='h'><a href='/'>PHP & JavaScript Room</a> :: 設置サンプル</h1> <h3 class='h'>実行結果</h3> <div id="wrap"> <h1>設置サンプル</h1> <h2>animation-timing-function</h2> <p>アニメーションをどのように実行するか進捗方法を加速曲線で指定します。</p> <!-- CODE --> <p id="rgrp"> animation-timing-function: <label for="r1"><input type="radio" name="r" id="r1" value="linear">linear</label> <label for="r2"><input type="radio" name="r" id="r2" value="ease" checked="checked">ease</label> <label for="r3"><input type="radio" name="r" id="r3" value="ease-in">ease-in</label> <label for="r4"><input type="radio" name="r" id="r4" value="ease-out">ease-out</label> <label for="r5"><input type="radio" name="r" id="r5" value="ease-in-out">ease-in-out</label> </p> <div id="sample"> <p>Sample</p> </div> <hr /> <div id="samples"> <div id="linear">linear</div> <div id="ease">ease</div> <div id="ease-in">ease-in</div> <div id="ease-out">ease-out</div> <div id="ease-in-out">ease-in-out</div> </div> <!-- CODE / --> </div> </body> </html>