How to use the transformation-matrix.rotate function in transformation-matrix

To help you get started, we’ve selected a few transformation-matrix examples, based on popular ways it is used in public projects.

github skmail / react-free-transform / src / ElementStyler.js View on Github external
const newWidth = width - changedWidth;
  const changedHeight = height * (1 - scaleY);
  const newHeight = height - changedHeight;

  let transformMatrix;

  if(disableScale === false){
    transformMatrix = transform(
      translate(roundTo(x + changedWidth / 2), roundTo(y + changedHeight / 2)),
      rotate(angle * (Math.PI / 180)),
      scale(scaleX, scaleY)
    );
  }else{
    transformMatrix = transform(
      translate(roundTo(x + changedWidth ), roundTo(y + changedHeight )),
      rotate(angle * (Math.PI / 180)),
    );
    width = newWidth;
    height = newHeight;
  }

  return {
    element: {
      width,
      height,
      transform: toCSS(transformMatrix),
      position: "absolute",
    },
    controls: {
      width: newWidth,
      height: newHeight,
      transform: toCSS(