Skip to content

Commit

Permalink
#150 createGradientBoxを改修
Browse files Browse the repository at this point in the history
  • Loading branch information
ienaga committed Sep 29, 2023
1 parent d8facd9 commit 0914930
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion next2d.js

Large diffs are not rendered by default.

20 changes: 19 additions & 1 deletion packages/geom/src/Matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,25 @@ export class Matrix
rotation: number = 0,
tx: number = 0, ty: number = 0
): void {
this.createBox(width / 1638.4, height / 1638.4, rotation, tx + width / 2, ty + height / 2);

this.a = width / 1638.4;
this.d = height / 1638.4;

if (rotation) {
const cos = $Math.cos(rotation);
const sin = $Math.sin(rotation);

this.b = sin * this.d;
this.c = -sin * this.a;
this.a *= cos;
this.d *= cos;
} else {
this.b = 0;
this.c = 0;
}

this.tx = tx + width / 2;
this.ty = ty + height / 2;
}

/**
Expand Down

0 comments on commit 0914930

Please sign in to comment.