Sha256: 2d5598e489e614584380c0a76410c020df9eb8fc42ffdd3c749057e2445ddfc0

Contents?: true

Size: 933 Bytes

Versions: 12

Compression:

Stored size: 933 Bytes

Contents

module Teacup

  class Stylesheet
    def identity
      [1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1]
    end

    def pi
      3.1415926
    end

    # rotates the "up & down" direction.  The bottom of the view will rotate
    # towards the user as angle increases.
    def flip matrix, angle
      CATransform3DRotate(matrix, angle, 1, 0, 0)
    end

    # rotates the "left & right" direction.  The right side of the view will
    # rotate towards the user as angle increases.
    def twist matrix, angle
      CATransform3DRotate(matrix, angle, 0, 1, 0)
    end

    # spins, along the z axis.  This is probably the one you want, for
    # "spinning" a view like you might a drink coaster or paper napkin.
    def spin matrix, angle
      CATransform3DRotate(matrix, angle, 0, 0, 1)
    end

    # rotates the layer arbitrarily
    def rotate matrix, angle, x, y, z
      CATransform3DRotate(matrix, angle, x, y, z)
    end

  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
teacup-0.3.12 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.11 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.10 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.9 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.8 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.7 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.6 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.5 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.4 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.3 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.2 lib/teacup/stylesheet_extensions/rotation.rb
teacup-0.3.1 lib/teacup/stylesheet_extensions/rotation.rb