Sha256: 26247bc28907ae396f4e2a7ebdddd24726ec7a3fb5c0c8463845d2e1038cec11

Contents?: true

Size: 575 Bytes

Versions: 21

Compression:

Stored size: 575 Bytes

Contents

# @requires MotionKit::UIViewHelpers
module MotionKit
  class UIViewHelpers

    # gradient colors:
    def gradient(&block)
      gradient_layer = target.motion_kit_meta[:motionkit_gradient_layer] || begin
        gradient_layer = CAGradientLayer.layer
        gradient_layer.frame = CGRect.new([0, 0], target.frame.size)
        target.layer.insertSublayer(gradient_layer, atIndex:0)
        target.motion_kit_meta[:motionkit_gradient_layer] = gradient_layer

        gradient_layer
      end

      context(gradient_layer, &block)

      gradient_layer
    end

  end
end

Version data entries

21 entries across 15 versions & 1 rubygems

Version Path
motion-kit-0.12.0 lib/motion-kit-ios/layouts/uiview_layout_gradient.rb