transformation

transformation

Operation — affine helpers on paths (rotate, scale, translate, …). See Operations.

Imports

import {
  translate, translateToOrigin, translateCentroidTo, translateCornerTo,
  rotate, rotateAroundCenter, scale, originScale,
  flipHorizontal, flipVertical, resizeByWidth, resizeByHeight, shear,
  transformation,
} from 'pattapatta'

Functions

FunctionDescription
translate(p, dx, dy)Shift
translateToOrigin / translateCentroidTo / translateCornerToPlace by centroid / corner
rotate(p, angle, pivot?)Radians
rotateAroundCenterPivot = centroid
scale(p, sx, sy?, pivot?)Scale about pivot
originScaleScale about (0,0)
flipHorizontal / flipVerticalMirror
resizeByWidth / resizeByHeightUniform fit to AABB size
shear(p, shx, shy?, pivot?)Shear

Examples

Translate

Translate

Rotate

Rotate

Scale

Scale