class Teacup::TransformView

Public Instance Methods

identity() click to toggle source
# File lib/teacup/stylesheet_extensions/transform.rb, line 77
def identity
  [1, 0, 0, 1, 0, 0]
end
rotate(angle) click to toggle source

Rotates the view counterclockwise

# File lib/teacup/stylesheet_extensions/transform.rb, line 82
def rotate angle
  CGAffineTransformMakeRotation(angle)
end
scale(scale_x, scale_y=nil) click to toggle source

Scales the view

# File lib/teacup/stylesheet_extensions/transform.rb, line 87
def scale scale_x, scale_y=nil
  scale_y ||= scale_x
  CGAffineTransformMakeScale(scale_x, scale_y)
end
translate(point, y=nil) click to toggle source

Translates the view

# File lib/teacup/stylesheet_extensions/transform.rb, line 93
def translate point, y=nil
  if point.respond_to?(:x) &&point.respond_to?(:y)
    x = point.x
    y = point.y
  elsif point.is_a? Array
    x = point[0]
    y = point[1]
  else
    x = point
  end
  CGAffineTransformMakeTranslation(x, y)
end