Module: VectorSalad::Mixins::Transforms

Includes:
Contracts::Core
Included in:
StandardShapes::Group, StandardShapes::MultiPath
Defined in:
lib/vector_salad/mixins/transforms.rb

Overview

Mixin for transforming shapes.

Instance Method Summary (collapse)

Instance Method Details

- (Any) [](x, y)

Move the shape absolutely.

Parameters:

  • x (Num)
  • y (Num)

Returns:

  • (Any)


13
14
15
# File 'lib/vector_salad/mixins/transforms.rb', line 13

def [](x, y)
  each_send(:[], x, y)
end

- (Any) move(x, y)

Move the shape relatively.

Parameters:

  • x (Num)
  • y (Num)

Returns:

  • (Any)


19
20
21
# File 'lib/vector_salad/mixins/transforms.rb', line 19

def move(x, y)
  each_send(:move, x, y)
end

- (Any) rotate(angle)

Rotates the shape by the specified angle about the origin.

Parameters:

  • angle (Num)

Returns:

  • (Any)


25
26
27
# File 'lib/vector_salad/mixins/transforms.rb', line 25

def rotate(angle)
  each_send(:rotate, angle)
end

- (Any) scale(multiplier)

Scale a shape by multiplier about the origin.

Parameters:

  • multiplier (Num)

Returns:

  • (Any)


31
32
33
# File 'lib/vector_salad/mixins/transforms.rb', line 31

def scale(multiplier)
  each_send(:scale, multiplier)
end