PHP & JavaScript Room :: 設置サンプル

実行結果

設置サンプル

animation-direction

アニメーションする方向を指定します。デフォルト方向⇔逆交互に再生する場合は、alternateを指定します。

animation-direction:   

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-direction</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-direction",val);
               $obj.css("animation-direction",val);
            });
          });
      </script>
      <style type="text/css">
         #sample {
            width:500px; height:300px;
            background:#eee;
         }
         #sample p {
            margin:0; padding:0;
            width:100px; height:100px;
            background:#ccc;
            position:relative;
            line-height:100px;
            text-align:center;
            font-weight:bold;

            animation:myani 3s linear 0 infinite; /* CSS3 */
            -webkit-animation:myani 3s linear 0 infinite; /* Chrome, Safari */
            -moz-animation:myani 3s linear 0 infinite; /* Firefox */
            -ms-animation:myani 3s linear 0 infinite; /* IE */
            -o-animation:myani 3s linear 0 infinite; /* Opera */
            
         }
         @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;}
         }
      </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 &amp; JavaScript Room</a> :: 設置サンプル</h1>
<h3 class='h'>実行結果</h3>
      <div id="wrap">
         <h1>設置サンプル</h1>
         <h2>animation-direction</h2>
         <p>アニメーションする方向を指定します。デフォルト方向⇔逆交互に再生する場合は、alternateを指定します。</p>
<!-- CODE -->
         <p id="rgrp">
            animation-direction: 
            <label for="r1"><input type="radio" name="r" id="r1" value="normal" checked="checked">normal</label> 
            <label for="r2"><input type="radio" name="r" id="r2" value="alternate">alternate</label>
         </p>
         <div id="sample">
            <p>Sample</p>
         </div>
<!-- CODE / -->
      </div>
   </body>
</html>