Class: Plushie::Canvas::Shape::Rotate

Inherits:
Data
  • Object
show all
Defined in:
lib/plushie/canvas/shape/transform.rb

Overview

Rotates the canvas coordinate system. Stored as degrees internally, matching the wire protocol convention. Use Shape.rotate for the degrees-by-default convenience constructor.

Examples:

Rotate.new(angle: 45)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(angle:) ⇒ Rotate

Returns a new instance of Rotate.



28
29
30
# File 'lib/plushie/canvas/shape/transform.rb', line 28

def initialize(angle:)
  super
end

Instance Attribute Details

#angleObject (readonly)

Returns the value of attribute angle

Returns:

  • (Object)

    the current value of angle



27
28
29
# File 'lib/plushie/canvas/shape/transform.rb', line 27

def angle
  @angle
end

Instance Method Details

#to_wireHash

Returns wire-ready transform map.

Returns:

  • (Hash)

    wire-ready transform map



33
34
35
# File 'lib/plushie/canvas/shape/transform.rb', line 33

def to_wire
  {type: "rotate", angle: angle}
end