Browse Source

Added transform() test

v1.x
Tj Holowaychuk 14 years ago
parent
commit
70e9cbc6b5
  1. 15
      test/public/tests.js

15
test/public/tests.js

@ -88,6 +88,21 @@ tests['quadraticCurveTo()'] = function(ctx){
ctx.stroke();
};
tests['transform()'] = function(ctx){
var sin = Math.sin(Math.PI/6);
var cos = Math.cos(Math.PI/6);
ctx.translate(100, 100);
ctx.scale(.5,.5);
var c = 0;
for (var i=0; i <= 12; i++) {
c = Math.floor(255 / 12 * i);
ctx.fillStyle = "rgb(" + c + "," + c + "," + c + ")";
ctx.fillRect(0, 0, 100, 10);
ctx.transform(cos, sin, -sin, cos, 0, 0);
}
};
tests['rotate()'] = function(ctx){
ctx.rotate(0.4);
ctx.translate(30,0);

Loading…
Cancel
Save