Raphaelist_vol27(rotate)
Raphael de SVG ! vol27
by nekosmash
HTML
<script type="text/javascript" src="http://dl.dropbox.com/u/63305355/raphael-min.js"></script>
<div id="canvas">
<div class="text">
ROTATE
<br>
<input type="button" value="すみっこ回転" onclick="rotate()" />
<input type="button" value="中央回転" onclick="rotateCenter()" />
<div id="result"></div>
</div>
</div>
CSS
body,html
{
height:100%;
margin:0;
}
#canvas
{
height:99%;
background:#ccc;
text-align:center;
}
.text{
letter-spacing: 20px;
color:#fff;
font-size:150%;
width:60%;
height:60%;
position:absolute;
left:20%;
top:40%;
z-index:1;
}
#result{
font-size:60%;
letter-spacing: 5px;
}
input{
padding:3px;
}
JavaScript
var rect;
window.onload = function(){
var paper = Raphael(0,0,"100%","100%");
rect = paper.rect(0,0,100,100)
.attr({fill:"90-#804-#202-#305"});
}
function rotate(){
//幅を拡げる
rect.rotate(5,0,0);
}
function rotateCenter(){
//高さを拡げる
rect.rotate(5);
}