Skip to content

Commit

Permalink
add support for shear
Browse files Browse the repository at this point in the history
  • Loading branch information
flyover committed May 12, 2016
1 parent 64c3cf0 commit 8772571
Show file tree
Hide file tree
Showing 3 changed files with 297 additions and 125 deletions.
1 change: 1 addition & 0 deletions demo/render-ctx2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,7 @@ function ctxApplySpace(ctx, space) {
if (space) {
ctx.translate(space.position.x, space.position.y);
ctx.rotate(space.rotation.rad);
ctx.transform(space.shear.x.cos, space.shear.x.sin, -space.shear.y.sin, space.shear.y.cos, 0, 0);
ctx.transform(space.scale.a, space.scale.c, space.scale.b, space.scale.d, 0, 0);
}
}
Expand Down
1 change: 1 addition & 0 deletions demo/render-webgl.js
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,7 @@ function mat3x3ApplySpace(m, space) {
if (space) {
mat3x3Translate(m, space.position.x, space.position.y);
mat3x3RotateCosSin(m, space.rotation.cos, space.rotation.sin);
mat3x3Multiply2x2(m, space.shear.x.cos, -space.shear.y.sin, space.shear.x.sin, space.shear.y.cos);
mat3x3Multiply2x2(m, space.scale.a, space.scale.b, space.scale.c, space.scale.d);
}
return m;
Expand Down
Loading

0 comments on commit 8772571

Please sign in to comment.