Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add skewX/Y methods to API #25

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,18 @@ Rotate path to `angle` degree around (rx, ry) point. If rotation center not set,
(0, 0) used. The same as SVG `rotate` transformation.


### .skewX(angle) -> self

Skews path along the x axis by `angle` degrees. The same as SVG `skewX`
transformation.


### .skewY(angle) -> self

Skews path along the y axis by `angle` degrees. The same as SVG `skewY`
transformation.


### .matrix([ m1, m2, m3, m4, m5, m6 ]) -> self

Apply 2x3 affine transform matrix to path. Params - array. The same as SVG
Expand Down
13 changes: 13 additions & 0 deletions lib/svgpath.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,19 @@ SvgPath.prototype.rotate = function (angle, rx, ry) {
return this;
};

// Skew path along x axis
//
SvgPath.prototype.skewX = function (angle) {
this.__stack.push(matrix().skewX(angle));
return this;
};

// Skew path along y axis
//
SvgPath.prototype.skewY = function (angle) {
this.__stack.push(matrix().skewY(angle));
return this;
};

// Apply matrix transform (array of 6 elements)
//
Expand Down