iPhoneのCSSで拡大・縮小・回転などのアニメーションさせる方法

2008/8/20 水曜日 Posted in iPhone | No Comments »

先日「iPhoneでJavaScriptを使わずCSSだけでアニメーションする方法」という記事を書きましたが、今回はその続きです。 前回は、左から右にすーっとアニメーションするだけでしたが、今回は拡大・縮小・回転といったアニメーションをさせてみたいと思います。 また前回は「-webkit-animation-name」を使う方法でしたが、今回はやり方を変えてみました。   静止画なのでわかりづらいですが、左からクルクルと回転しながら縮小して、右のようになります。   サンプルコードは次の通りです。 <html> <head> <meta name="viewport" content="width=320, user-scalable=no, maximum-scale=1.0" /> <script type="text/javascript"> function animationStart() { var el = document.getElementById("target"); el.style.webkitTransition = '-webkit-transform 3s ease-in-out'; el.style.webkitTransform = 'translate(180px,40px) rotate(180deg) scale(0.1)'; } </script> </head> <body> <input type="button" name="hoge" value="animation" onClick="animationStart();" /> <div id="target" style="width:120px; height:120px; background-color:red; position:absolute; ... Read more..