87,995
社区成员




<canvas id="canvas1" width="64" height="64"></canvas>
<script>
function MyCtx(ctx){
this.ctx = ctx;
}
(function (map){
for(var k in map){
MyCtx.prototype[k] = new Function('this.ctx.'+map[k]+'.apply(this.ctx,arguments); return this;');
}
}({
B:'beginPath', M:'moveTo', L:'lineTo', A:'arc', Z:'closePath', f:'fill', dI:'drawImage', cR:'clearRect', clip:'clip', save:'save', restore:'restore'
}));
function init(){
var ctx = document.getElementById("canvas1").getContext('2d');
var mtx = new MyCtx(ctx), i=-1;
mtx.ctx.fillStyle='rgba(0,0,0,0.6)';
function f(){
mtx.save().cR(0,0,64,64).dI(img,0,0).B().A(32,32,64,Math.abs(++i%720)*Math.PI/360, Math.PI*2,(i/720|0)%2).L(32,32).Z().clip().f().restore();
setTimeout(f,20);
}
f();
}
var img = new Image();
img.src = 'http://www.etherdream.com/funnyscript/WarIcon/Icon1.PNG';
img.onload = init();
</script>