Skip to content

How to get the coordinates of the image after rotation #935

Answered by stockiNail
anhln1998 asked this question in Q&A
Discussion options

You must be logged in to vote

@anhln1998 the plugin is not exporting the helpers therefore, even if there is the function, you cannot invoked.

Nevertheless, is not an issue for you, you can take it and copy in your project:

/**
* Rotate a `point` relative to `center` point by `angle`
* @param {Point} point - the point to rotate
* @param {Point} center - center point for rotation
* @param {number} angle - angle for rotation, in radians
* @returns {Point} rotated point
*/
export function rotated(point, center, angle) {
const cos = Math.cos(angle);
const sin = Math.sin(angle);

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@anhln1998
Comment options

@stockiNail
Comment options

@anhln1998
Comment options

@stockiNail
Comment options

@anhln1998
Comment options

Answer selected by stockiNail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants