Sha256: e8496f88e90ba9d1f8f914d9fb3f02cd5f9e9eadecce1e131f0c1209b1b62c96

Contents?: true

Size: 700 Bytes

Versions: 3

Compression:

Stored size: 700 Bytes

Contents

# This transformation is used to rotate the user space. Give it an angle
# and an <code>:origin</code> point about which to rotate and a block.
# Everything inside the block will be drawn with the rotated coordinates.
#
# The angle is in degrees.
#
# If you omit the <code>:origin</code> option the page origin will be used.

require_relative '../example_helper'

filename = File.basename(__FILE__).gsub('.rb', '.pdf')
Prawn::ManualBuilder::Example.generate(filename) do
  stroke_axis

  fill_circle [250, 200], 2

  12.times do |i|
    rotate(i * 30, origin: [250, 200]) do
      stroke_rectangle [350, 225], 100, 50
      draw_text "Rotated #{i * 30}°", size: 10, at: [360, 205]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
prawn-2.2.2 manual/graphics/rotate.rb
prawn-2.2.1 manual/graphics/rotate.rb
prawn-2.2.0 manual/graphics/rotate.rb