Skip to contents

Applies a shear transform about the pivot (about_x, about_y): shx displaces x-coordinates in proportion to y (distance from about_y), shy displaces y-coordinates in proportion to x (distance from about_x).

Usage

trans_shear(shx = 0, shy = 0, about_x = 0, about_y = 0)

Arguments

shx, shy

Shear factors along the x/y axes. Default 0 for both.

about_x, about_y

Pivot point coordinates. Default 0.

Examples

draw(shape_square(side = 1, trans = trans_shear(shx = 0.5)))


# overlay the original (faded) with the sheared copy (solid)
original <- shape_rectangle(
  width = 1,
  height = 0.6,
  fill_alpha = 0.3,
  color_alpha = 0.3
)
draw(sketch() + original + (original + trans_shear(shx = 0.6)))


# shy shears vertically instead of horizontally
draw(shape_square(side = 1, trans = trans_shear(shy = 0.5)))