Class: VectorSalad::StandardShapes::Scale

Inherits:
Transform
  • Object
show all
Defined in:
lib/vector_salad/standard_shapes/scale.rb

Overview

Scale the contained shapes by multiplier about the origin.

Instance Method Summary collapse

Constructor Details

#initialize(x_multiplier, y_multiplier = x_multiplier, canvas:, **_options, &block) ⇒ Scale

Returns a new instance of Scale.



24
25
26
27
28
29
30
31
32
# File 'lib/vector_salad/standard_shapes/scale.rb', line 24

def initialize(x_multiplier,
               y_multiplier = x_multiplier,
               canvas:, **_options, &block)
  instance_eval(&block) # inner_canvas is populated

  @canvas.each do |shape|
    canvas << shape.scale(x_multiplier, y_multiplier)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class VectorSalad::DSL