2012-01-12 20 views
0

私はRaphaelを使用しています。ここで私はアニメーションで回転したいテトリスのブロックのためのコードは次のとおりです。回転がattr()プロパティとして認識されません

function ele(id) { 
     return document.getElementById(id); 
    } 

    window.onload = function() { 
     var paper = new Raphael(ele('canvas_container'), 500, 500); 

     var tetronimo = paper.path('M 250 250 l 0 -50 l -50 0 l 0 -50 l -50 0 l 0 50 l -50 0 l 0 50 z') 
     tetronimo.attr({ 
      gradient: '90-#526c7a-#64a0c1', 
      stroke: '#3b4449', 
      'stroke-width':10, 
      'stroke-linejoin':'round', 
      rotation:-90, //**This is where the problem is** 
      title:'This is a tetris block' 
     }); 

     tetronimo.animate({ 
      rotation:360 //**This is where the problem is** 
     }, 2000, 'bounce'); 
    } 

このコードはまた、このチュートリアルで見つけることができます:http://net.tutsplus.com/tutorials/javascript-ajax/an-introduction-to-the-raphael-js-library/

アニメーションをトリガーonload以外のイベントはありませんただし、ページが読み込まれてもアニメーションは実行されません。私はまた、ラファエロの変換方法を使用して試してみました。

tetronimo.attr({ 
      gradient: '90-#526c7a-#64a0c1', 
      stroke: '#3b4449', 
      'stroke-width':10, 
      'stroke-linejoin':'round', 
      transform:'r90', 
      title:'This is a tetris block' 
     }); 
tetronimo.animate({ 
      transform:'r360' 
     }, 2000, 'bounce'); 

これも機能しません。アイデア?

答えて

1

this answerによれば、回転はRaphael2.0で除去された。

私はあなたのtransformの例をRaphael playground pageで試してみましたが、それは私のために働いた

関連する問題